Re: [web-audio-api] (ExceptionType): Undefined exception type (#106)

> [Original comment](https://www.w3.org/Bugs/Public/show_bug.cgi?id=17325#1) by Philip Jägenstedt on W3C Bugzilla. Thu, 26 Jul 2012 12:40:09 GMT

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

---
Reply to this email directly or view it on GitHub:
https://github.com/WebAudio/web-audio-api/issues/106#issuecomment-24244223

Received on Wednesday, 11 September 2013 14:34:17 UTC