Fix a case where glGetError() can return two different errors sequentially

If the Emscripten wrapper generates its own error message, and the WebGL context
also generates an error message, then the next 2 calls to glGetError() could
both report error messages instead of only the first one erroring. This patch
fixes that possibility.
glTex[Sub]Image* should not throw an exception, but should cause a GL_INVALID_ENUM error on unrecognized formats or types