Bugzilla – Bug 17325
(ExceptionType): Undefined exception type
Last modified: 2013-09-09 13:09:57 UTC
Audio-ISSUE-22 (ExceptionType): Undefined exception type [Web Audio API]
Raised by: Philip Jägenstedt
On product: Web Audio API
The phrase "An exception will be thrown" is used throughout the spec, but the specific exception that should be throw is never defined.
Comment from Chris Rogers, 18 May 2012
«I'm unfamiliar with common convention for "what type" of exceptions will be thrown. I'm happy to add them according to your exact recommendations»
The createBuffer method could be written as:
If numberOfChannels is greater than 32, if sampleRate is less than 22050 or if sampleRate is greater than 96000, then throw an IndexSizeError. Otherwise, return a new AudioBuffer with sampleRate *sampleRate*, length *length*, numberOfChannels *numberOfChannels*, where all samples have the value 0.
IndexSizeError works for most of these range-checks. For noteOn and other places that check state, InvalidStateError is appropriate.
If exceptions are ever thrown in an algorithm with multiple steps, the magic words "and terminate these steps" must be included as noted in http://wiki.whatwg.org/wiki/Howto_spec#Dealing_with_exceptions
This issue has been stalled for a while - it was once assigned to Philip but he is set to be away for a while. Ehsan, is that something you could look into?
If that's OK with Chris, sure!
(In reply to comment #4)
> If that's OK with Chris, sure!
sounds good to me
*** Bug 19901 has been marked as a duplicate of this bug. ***
I've been pushing a patch  to address this problem, please complain if you think that we should throw different exceptions.