Skip to content

Commit d0b7e96

Browse files
committed
Add DOMException cause
1 parent d720ef3 commit d0b7e96

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

index.bs

+22-4
Original file line numberDiff line numberDiff line change
@@ -14559,13 +14559,20 @@ 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 = "Error";
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 (DOMExceptionOptions or DOMString) options = {});
1456614572
readonly attribute DOMString name;
1456714573
readonly attribute DOMString message;
1456814574
readonly attribute unsigned short code;
14575+
readonly attribute any cause;
1456914576

1457014577
const unsigned short INDEX_SIZE_ERR = 1;
1457114578
const unsigned short DOMSTRING_SIZE_ERR = 2;
@@ -14601,19 +14608,28 @@ requirements beyond the normal ones for [=interface types=].
1460114608
Each {{DOMException}} object has an associated <dfn for="DOMException">name</dfn> and
1460214609
<dfn for="DOMException">message</dfn>, both [=strings=].
1460314610

14611+
Each {{DOMException}} object has an associated <dfn for="DOMException">cause</dfn>, which
14612+
is a JavaScript value. It is {{undefined}} unless specified otherwise.
14613+
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, options)"><code>new DOMException(|message|, |options|)</code></dfn>
1460614616
constructor steps are:
1460714617

14608-
1. Set [=this=]'s [=DOMException/name=] to |name|.
14609-
1. Set [=this=]'s [=DOMException/message=] to |message|.
14618+
1. Set [=this=]'s [=DOMException/message=] to |message|.
14619+
1. If |options| is a string, then set [=this=]'s [=DOMException/name=] to |options|.
14620+
1. Otherwise,
14621+
1. Set [=this=]'s [=DOMException/name=] to |options|["{{DOMExceptionOptions/name}}"].
14622+
1. Set [=this=]'s [=DOMException/cause=] to |options|["{{DOMExceptionOptions/cause}}"].
1461014623

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

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

14630+
The <dfn attribute for="DOMException"><code>cause</code></dfn> getter steps are to
14631+
return [=this=]'s [=DOMException/cause=].
14632+
1461714633
The <dfn attribute for="DOMException"><code>code</code></dfn> getter steps are to return the legacy
1461814634
code indicated in the [=error names table=] for [=this=]'s [=DOMException/name=], or 0 if no such
1461914635
entry exists in the table.
@@ -14625,6 +14641,7 @@ Their [=serialization steps=], given <var>value</var> and <var>serialized</var>,
1462514641
<ol>
1462614642
<li>Set <var>serialized</var>.\[[Name]] to <var>value</var>'s [=DOMException/name=].</li>
1462714643
<li>Set <var>serialized</var>.\[[Message]] to <var>value</var>'s [=DOMException/message=].</li>
14644+
<li>Set <var>serialized</var>.\[[Cause]] to <var>value</var>'s [=DOMException/cause=].</li>
1462814645
<li>User agents should attach a serialized representation of any interesting accompanying data
1462914646
which are not yet specified, notably the <code>stack</code> property, to
1463014647
<var>serialized</var>.</li>
@@ -14635,6 +14652,7 @@ Their [=deserialization steps=], given <var>value</var> and <var>serialized</var
1463514652
<ol>
1463614653
<li>Set <var>value</var>'s [=DOMException/name=] to <var>serialized</var>.\[[Name]].</li>
1463714654
<li>Set <var>value</var>'s [=DOMException/message=] to <var>serialized</var>.\[[Message]].</li>
14655+
<li>Set <var>value</var>'s [=DOMException/cause=] to <var>serialized</var>.\[[Cause]].</li>
1463814656
<li>If any other data is attached to <var>serialized</var>, then deserialize and attach it to
1463914657
<var>value</var>.</li>
1464014658
</ol>

0 commit comments

Comments
 (0)