[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] Exceptions in WebGL
On Mon, Apr 5, 2010 at 12:23 AM, Gregg Tavares <email@example.com> wrote:
> Maybe I'm skimming over it but it doesn't appear there is any language in
> the current spec about what WebGL functions should throw an exception and
> under what conditions even though every function is specified has able to
> throw one.
> for example.
> ctx.getActiveUniform(validProgram, invalidIndex); exception or
> ctx.getActiveUniform(null, 0); // This must be INVALID_VALUE but the spec
> doesn't stay
> ctx.getActiveUniform(validProgramFromDifferenceContext, 0); // exception or
> ctx.getActiveUniform(deletedProgram, 0); // exception or INVALID_VALUE?
> ctx.getActiveUniform(undefined, 0); // exception or INVALID_VALUE?
> ctx.getActiveUniform(texture, 0); // exception or INVALID_OPERATION
> Pretty much every function has the same issues.
> Should this be nailed down? Am I just missing the section that covers it?
Earlier in the development of the WebGL spec it wasn't well defined
which sorts of invalid inputs throw exceptions and which synthesize
OpenGL errors. A few months ago after much discussion it was decided
that the error handling would be unified to always synthesize OpenGL
errors, and not throw exceptions. This unifies the error handling
behavior and makes it easier to write things like debug GL wrappers
which turn OpenGL errors into exceptions.
The fact that the IDL still states that all of the entry points raise
DOMException is basically an artifact. The best explanation for why
this hasn't changed is so that the option is available in the future
to throw DOMException if necessary.
Some of the situations above (where you're passing an object of the
wrong type) should be defined by Web IDL, I think, and should throw a
SYNTAX_ERR DOMException. However, if the call makes it through the
You are currently subscribe to firstname.lastname@example.org.
To unsubscribe, send an email to email@example.com with
the following command in the body of your email: