Skip to content

Commit

Permalink
Add DOMException cause
Browse files Browse the repository at this point in the history
  • Loading branch information
legendecas committed Aug 13, 2022
1 parent d720ef3 commit 567cfc9
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -14559,12 +14559,19 @@ The {{DOMException}} type is an [=interface type=] defined by the following IDL
fragment:

<pre class="idl">

dictionary DOMExceptionOptions {
any cause;
DOMString name;
};

[Exposed=(Window,Worker),
Serializable]
interface DOMException { // but see below note about ECMAScript binding
constructor(optional DOMString message = "", optional DOMString name = "Error");
constructor(optional DOMString message = "", optional (DOMString or DOMExceptionOptions) nameOrOptions = "Error");
readonly attribute DOMString name;
readonly attribute DOMString message;
readonly attribute any cause;
readonly attribute unsigned short code;

const unsigned short INDEX_SIZE_ERR = 1;
Expand Down Expand Up @@ -14598,22 +14605,31 @@ interface DOMException { // but see below note about ECMAScript binding
Note: as discussed in [[#es-DOMException-specialness]], the ECMAScript binding imposes additional
requirements beyond the normal ones for [=interface types=].

Each {{DOMException}} object has an associated <dfn for="DOMException">name</dfn> and
<dfn for="DOMException">message</dfn>, both [=strings=].
Each {{DOMException}} object has associated fields:

* its <dfn for="DOMException">name</dfn>, which is [=strings=],
* its <dfn for="DOMException">message</dfn>, which is [=strings=],
* its <dfn for="DOMException">cause</dfn>, which is {{any}} value.

The
<dfn constructor for="DOMException" lt="DOMException(message, name)"><code>new DOMException(|message|, |name|)</code></dfn>
<dfn constructor for="DOMException" lt="DOMException(message, nameOrOptions)"><code>new DOMException(|message|, |nameOrOptions|)</code></dfn>
constructor steps are:

1. Set [=this=]'s [=DOMException/name=] to |name|.
1. Set [=this=]'s [=DOMException/message=] to |message|.
1. If |nameOrOptions| is a string, set [=this=]'s [=DOMException/name=] to |nameOrOptions|.
1. Else,
1. If |nameOrOptions|'name is present, set [=this=]'s [=DOMException/name=] to |nameOrOptions|'s name, else set [=this=]'s [=DOMException/name=] to "Error".
1. If |nameOrOptions|'cause is present, set [=this=]'s [=DOMException/cause=] to |nameOrOptions|'s cause.

The <dfn attribute for="DOMException"><code>name</code></dfn> getter steps are to return
[=this=]'s [=DOMException/name=].

The <dfn attribute for="DOMException"><code>message</code></dfn> getter steps are to
return [=this=]'s [=DOMException/message=].

The <dfn attribute for="DOMException"><code>cause</code></dfn> getter steps are to
return [=this=]'s [=DOMException/cause=].

The <dfn attribute for="DOMException"><code>code</code></dfn> getter steps are to return the legacy
code indicated in the [=error names table=] for [=this=]'s [=DOMException/name=], or 0 if no such
entry exists in the table.
Expand Down

0 comments on commit 567cfc9

Please sign in to comment.