Re: Bug 24813 - Decide whether methods should return DOMError or null on failure

My personal experience writing regression tests for WebCrypto convinced me that it's difficult to use the API without detailed errors being produced for mistakes. At least I could resort to stepping through the implementation in a debugger, which will not be an option for most.

Note that per <https://github.com/domenic/promises-unwrapping/blob/master/docs/writing-specifications-with-promises.md>, 

---------------------------------
Promise rejections should always be instances of the ECMAScript Error type, just like synchronously-thrown exceptions should always be instances of Error as well.

In particular, for DOM or other web platform specs, this means you should never use DOMError, but instead use DOMException, which per WebIDL extends Error.
---------------------------------

So, the suggestion is to use DOMException, not null. I don't personally care which exception codes to use, however a good implementation should provide a helpful explanatory message for each rejection.

- WBR, Alexey Proskuryakov

28 февр. 2014 г., в 8:47, Ryan Sleevi <sleevi@google.com> написал(а):

> Are you making a proposal for what the errors should be?
> 
> That was and remains what's missing - someone to demonstrate value in having discrete errors by making a proposal.
> 
> On Feb 28, 2014 8:44 AM, "Mark Watson" <watsonm@netflix.com> wrote:
> https://www.w3.org/Bugs/Public/show_bug.cgi?id=24813
> 
> Opinions ?
> 
> ...Mark

Received on Friday, 28 February 2014 17:46:10 UTC