Ive run into this issue + cant use gl.getError(); to narrow down my search of where its occuring, since it doesnt work correctly. hmm perhaps I can use glFinish();
Are there any debuggers for webGL like there is with opengl?

Code :
setup() {
  // error is happening here somewhere
  gl.getError(); // BUT no error gets reported here
  setInterval(loop, 1000.0/60.0 );
  gl.getError(); // no error
// no code after this
loop() {
 gl.getError(); // error gets reported here

cheers zed