Compare gl.getError() to an integer instead of a boolean.