generated from tc39/template-for-proposals
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathspec.emu
More file actions
73 lines (62 loc) · 5.43 KB
/
spec.emu
File metadata and controls
73 lines (62 loc) · 5.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!doctype html>
<meta charset="utf8">
<link rel="stylesheet" href="./spec.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/github.min.css">
<script src="./spec.js"></script>
<pre class="metadata">
title: Error Stack Accessor
stage: 2
contributors: Jordan Harband, Mark Miller
</pre>
<emu-clause id="sec-fundamental-objects" number="20">
<h1>Fundamental Objects</h1>
<emu-clause id="sec-error-objects" number="5">
<h1>Error Objects</h1>
<emu-clause id="sec-properties-of-the-error-prototype-object" number="3">
<h1>Properties of the Error Prototype Object</h1>
<emu-clause id="sec-get-error.prototype-stack">
<h1>Error.prototype.stack</h1>
<p>`Error.prototype.stack` is an accessor property with attributes { [[Enumerable]]: *false*, [[Configurable]]: *true* }. The [[Get]] and [[Set]] attributes are defined as follows:</p>
<emu-clause id="sec-get-error.prototype.stack">
<h1>get Error.prototype.stack</h1>
<p>The value of the [[Get]] attribute is a built-in function that requires no arguments. It performs the following steps when called:</p>
<emu-alg>
1. Let _E_ be the *this* value.
1. If _E_ is not an Object, throw a *TypeError* exception.
1. If _E_ does not have an [[ErrorData]] internal slot, return *undefined*.
1. Return an implementation-defined string that represents the stack trace of _E_.
</emu-alg>
</emu-clause>
<emu-clause id="sec-set-error.prototype.stack">
<h1>set Error.prototype.stack</h1>
<p>The value of the [[Set]] attribute is a built-in function that takes an argument _v_. It performs the following steps when called:</p>
<emu-alg>
1. Let _E_ be the *this* value.
1. If _E_ is not an Object, throw a *TypeError* exception.
1. If _v_ is not a String, throw a *TypeError* exception.
1. Perform ? SetterThatIgnoresPrototypeProperties(*this* value, %Error.prototype%, *"stack"*, _v_).
1. Return *undefined*.
</emu-alg>
</emu-clause>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-error-instances" number="4">
<h1>Properties of Error Instances</h1>
<p>Error instances are ordinary objects that inherit properties from the Error prototype object and have an [[ErrorData]] internal slot whose value is *undefined*. <del>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.</del><ins>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 `Object.prototype.toString` and `Error.isError`; as well as for the <emu-xref href="#sec-get-error.prototype-stack">Error.prototype.stack accessor</emu-xref>.</ins></p>
</emu-clause>
<emu-clause id="sec-nativeerror-object-structure" number="6">
<h1>_NativeError_ Object Structure</h1>
<emu-clause id="sec-properties-of-nativeerror-instances" number="4">
<h1>Properties of _NativeError_ Instances</h1>
<p>_NativeError_ instances are ordinary objects that inherit properties from their _NativeError_ prototype object and have an [[ErrorData]] internal slot whose value is *undefined*. <del>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.</del><ins>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 `Object.prototype.toString` and `Error.isError`; as well as for the <emu-xref href="#sec-get-error.prototype-stack">Error.prototype.stack accessor</emu-xref>.</ins></p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-aggregate-error-objects" number="7">
<h1>AggregateError Objects</h1>
<emu-clause id="sec-properties-of-aggregate-error-instances" number="4">
<h1>Properties of AggregateError Instances</h1>
<p>AggregateError instances are ordinary objects that inherit properties from their AggregateError prototype object and have an [[ErrorData]] internal slot whose value is *undefined*. <del>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.</del><ins>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 `Object.prototype.toString` and `Error.isError`; as well as for the <emu-xref href="#sec-get-error.prototype-stack">Error.prototype.stack accessor</emu-xref>.</ins></p>
</emu-clause>
</emu-clause>
</emu-clause>
</emu-clause>