W3C home > Mailing lists > Public > public-webcrypto@w3.org > March 2014

Errors: throw vs return

From: Mark Watson <watsonm@netflix.com>
Date: Wed, 5 Mar 2014 15:59:48 -0800
Message-ID: <CAEnTvdARftXosoP4jidPFQEFj=YM2X+oY79UJDPROQu0Dpa8aQ@mail.gmail.com>
To: "public-webcrypto@w3.org" <public-webcrypto@w3.org>

Our SubtleCrypto methods do *not* "throw" errors. Instead we call the
reject handler of the promise with the error object (to be a DOMException
according to the other thread).

My question is how we should describe termination with errors in the
asynchronous substeps and the steps of the operations. We could say:

"Return a SyntaxError"


"Throw a SyntaxError"

In either case we need to make the Step 4 or each method clearer:

"4. If the following steps or the steps of invoked operations
(throw|return) an error, perform the following sub-steps and terminate this

Since we might invoke other web platform procedures - like WebIDL type
conversion for example - which "throw" errors - perhaps we should use the
throw terminology in our procedures (and handle it in Step 4 of the method
procedures). Step 4 is like the "try ... catch ... " around all the
operations and other referenced procedures below.

Thoughts ?

Received on Thursday, 6 March 2014 00:00:15 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:02:41 UTC