Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bd43c90

Browse files
committed
Normative: add Error.prototype.stack (#3878)
See tc39/proposal-error-stack-accessor#9
1 parent 6dcb70f commit bd43c90

1 file changed

Lines changed: 31 additions & 3 deletions

File tree

spec.html

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31897,6 +31897,34 @@ <h1>Error.prototype.name</h1>
3189731897
<p>The initial value of `Error.prototype.name` is *"Error"*.</p>
3189831898
</emu-clause>
3189931899

31900+
<emu-clause id="sec-get-error.prototype-stack">
31901+
<h1>Error.prototype.stack</h1>
31902+
<p>`Error.prototype.stack` is an accessor property with attributes { [[Enumerable]]: *false*, [[Configurable]]: *true* }. The [[Get]] and [[Set]] attributes are defined as follows:</p>
31903+
31904+
<emu-clause id="sec-get-error.prototype.stack">
31905+
<h1>get Error.prototype.stack</h1>
31906+
<p>The value of the [[Get]] attribute is a built-in function that requires no arguments. It performs the following steps when called:</p>
31907+
<emu-alg>
31908+
1. Let _error_ be the *this* value.
31909+
1. If _error_ is not an Object, throw a *TypeError* exception.
31910+
1. If _error_ does not have an [[ErrorData]] internal slot, return *undefined*.
31911+
1. Return an implementation-defined string that represents the stack trace of _error_.
31912+
</emu-alg>
31913+
</emu-clause>
31914+
31915+
<emu-clause id="sec-set-error.prototype.stack">
31916+
<h1>set Error.prototype.stack</h1>
31917+
<p>The value of the [[Set]] attribute is a built-in function that takes an argument _value_. It performs the following steps when called:</p>
31918+
<emu-alg>
31919+
1. Let _error_ be the *this* value.
31920+
1. If _error_ is not an Object, throw a *TypeError* exception.
31921+
1. If _value_ is not a String, throw a *TypeError* exception.
31922+
1. Perform ? SetterThatIgnoresPrototypeProperties(_error_, %Error.prototype%, *"stack"*, _value_).
31923+
1. Return *undefined*.
31924+
</emu-alg>
31925+
</emu-clause>
31926+
</emu-clause>
31927+
3190031928
<emu-clause id="sec-error.prototype.tostring" type="built-in function">
3190131929
<h1>Error.prototype.toString ( )</h1>
3190231930
<p>This method performs the following steps when called:</p>
@@ -31916,7 +31944,7 @@ <h1>Error.prototype.toString ( )</h1>
3191631944

3191731945
<emu-clause id="sec-properties-of-error-instances">
3191831946
<h1>Properties of Error Instances</h1>
31919-
<p>Error instances are ordinary objects that inherit properties from the Error prototype object and have an [[ErrorData]] internal slot whose value is *undefined*. The only specified use of [[ErrorData]] is to identify Error, AggregateError, and _NativeError_ instances as Error objects within `Object.prototype.toString` and `Error.isError`.</p>
31947+
<p>Error instances are ordinary objects that inherit properties from the Error prototype object and have an [[ErrorData]] internal slot whose value is *undefined*. Specified uses of [[ErrorData]] include to identify <emu-xref href="#sec-error-constructor">Error</emu-xref>, <emu-xref href="#sec-aggregate-error-constructor">AggregateError</emu-xref>, and _NativeError_ instances as Error objects within <emu-xref href="#sec-object.prototype.tostring">Object.prototype.toString</emu-xref> and <emu-xref href="#sec-error.iserror">Error.isError</emu-xref>; as well as for the <emu-xref href="#sec-get-error.prototype-stack">Error.prototype.stack accessor</emu-xref>.</p>
3192031948
</emu-clause>
3192131949

3192231950
<emu-clause id="sec-native-error-types-used-in-this-standard">
@@ -32032,7 +32060,7 @@ <h1>_NativeError_.prototype.name</h1>
3203232060

3203332061
<emu-clause id="sec-properties-of-nativeerror-instances">
3203432062
<h1>Properties of _NativeError_ Instances</h1>
32035-
<p>_NativeError_ instances are ordinary objects that inherit properties from their _NativeError_ prototype object and have an [[ErrorData]] internal slot whose value is *undefined*. The only specified use of [[ErrorData]] is by `Object.prototype.toString` (<emu-xref href="#sec-object.prototype.tostring"></emu-xref>) and `Error.isError` (<emu-xref href="#sec-error.iserror"></emu-xref>) to identify Error, AggregateError, or _NativeError_ instances.</p>
32063+
<p>_NativeError_ instances are ordinary objects that inherit properties from their _NativeError_ prototype object and have an [[ErrorData]] internal slot whose value is *undefined*. Specified uses of [[ErrorData]] include to identify <emu-xref href="#sec-error-constructor">Error</emu-xref>, <emu-xref href="#sec-aggregate-error-constructor">AggregateError</emu-xref>, and _NativeError_ instances as Error objects within <emu-xref href="#sec-object.prototype.tostring">Object.prototype.toString</emu-xref> and <emu-xref href="#sec-error.iserror">Error.isError</emu-xref>; as well as for the <emu-xref href="#sec-get-error.prototype-stack">Error.prototype.stack accessor</emu-xref>.</p>
3203632064
</emu-clause>
3203732065
</emu-clause>
3203832066

@@ -32109,7 +32137,7 @@ <h1>AggregateError.prototype.name</h1>
3210932137

3211032138
<emu-clause id="sec-properties-of-aggregate-error-instances">
3211132139
<h1>Properties of AggregateError Instances</h1>
32112-
<p>AggregateError instances are ordinary objects that inherit properties from their AggregateError prototype object and have an [[ErrorData]] internal slot whose value is *undefined*. The only specified use of [[ErrorData]] is by `Object.prototype.toString` (<emu-xref href="#sec-object.prototype.tostring"></emu-xref>) and `Error.isError` (<emu-xref href="#sec-error.iserror"></emu-xref>) to identify Error, AggregateError, or _NativeError_ instances.</p>
32140+
<p>AggregateError instances are ordinary objects that inherit properties from their AggregateError prototype object and have an [[ErrorData]] internal slot whose value is *undefined*. Specified uses of [[ErrorData]] include to identify <emu-xref href="#sec-error-constructor">Error</emu-xref>, <emu-xref href="#sec-aggregate-error-constructor">AggregateError</emu-xref>, and _NativeError_ instances as Error objects within <emu-xref href="#sec-object.prototype.tostring">Object.prototype.toString</emu-xref> and <emu-xref href="#sec-error.iserror">Error.isError</emu-xref>; as well as for the <emu-xref href="#sec-get-error.prototype-stack">Error.prototype.stack accessor</emu-xref>.</p>
3211332141
</emu-clause>
3211432142
</emu-clause>
3211532143

0 commit comments

Comments
 (0)