Skip to content

Commit 1391e74

Browse files
committed
Add DOMException cause
1 parent d720ef3 commit 1391e74

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

index.bs

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14559,12 +14559,19 @@ The {{DOMException}} type is an [=interface type=] defined by the following IDL
1455914559
fragment:
1456014560

1456114561
<pre class="idl">
14562+
14563+
dictionary DOMExceptionOptions {
14564+
any cause;
14565+
DOMString name;
14566+
};
14567+
1456214568
[Exposed=(Window,Worker),
1456314569
Serializable]
1456414570
interface DOMException { // but see below note about ECMAScript binding
14565-
constructor(optional DOMString message = "", optional DOMString name = "Error");
14571+
constructor(optional DOMString message = "", optional (DOMString or DOMExceptionOptions) nameOrOptions = "Error");
1456614572
readonly attribute DOMString name;
1456714573
readonly attribute DOMString message;
14574+
readonly attribute any cause;
1456814575
readonly attribute unsigned short code;
1456914576

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

14601-
Each {{DOMException}} object has an associated <dfn for="DOMException">name</dfn> and
14602-
<dfn for="DOMException">message</dfn>, both [=strings=].
14608+
Each {{DOMException}} object has associated fields:
14609+
14610+
* its <dfn for="DOMException">name</dfn>, which is [=strings=],
14611+
* its <dfn for="DOMException">message</dfn>, which is [=strings=],
14612+
* its <dfn for="DOMException">cause</dfn>, which is {{any}} value.
1460314613

1460414614
The
14605-
<dfn constructor for="DOMException" lt="DOMException(message, name)"><code>new DOMException(|message|, |name|)</code></dfn>
14615+
<dfn constructor for="DOMException" lt="DOMException(message, nameOrOptions)">
14616+
<code>new DOMException(|message|, |nameOrOptions|)</code>
14617+
</dfn>
1460614618
constructor steps are:
1460714619

14608-
1. Set [=this=]'s [=DOMException/name=] to |name|.
14609-
1. Set [=this=]'s [=DOMException/message=] to |message|.
14620+
1. Set [=this=]'s [=DOMException/message=] to |message|.
14621+
1. If |nameOrOptions| is a string, set [=this=]'s [=DOMException/name=] to
14622+
|nameOrOptions|.
14623+
1. Else,
14624+
1. If |nameOrOptions|'name is present, set [=this=]'s [=DOMException/name=]
14625+
to |nameOrOptions|'s name, else set [=this=]'s [=DOMException/name=]
14626+
to "Error".
14627+
1. If |nameOrOptions|'cause is present, set [=this=]'s [=DOMException/cause=]
14628+
to |nameOrOptions|'s cause.
1461014629

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

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

14636+
The <dfn attribute for="DOMException"><code>cause</code></dfn> getter steps are to
14637+
return [=this=]'s [=DOMException/cause=].
14638+
1461714639
The <dfn attribute for="DOMException"><code>code</code></dfn> getter steps are to return the legacy
1461814640
code indicated in the [=error names table=] for [=this=]'s [=DOMException/name=], or 0 if no such
1461914641
entry exists in the table.

0 commit comments

Comments
 (0)