/
86.txt
147 lines (114 loc) · 6.51 KB
/
86.txt
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
* 仕様書
[REFS[
- [26] '''[CITE[ECMAScript® 2018 Language Specification]] ([TIME[2017-07-13 07:36:55 +09:00]]) <https://tc39.github.io/ecma262/#sec-error-objects>'''
- [9] [CITE[Web IDL (Second Edition)]] ([TIME[2015-05-27 01:29:33 +09:00]] 版) <http://heycam.github.io/webidl/#dfn-simple-exception>
- [15] [CITE[Web IDL (Second Edition)]] ([TIME[2015-05-27 01:29:33 +09:00]] 版) <http://heycam.github.io/webidl/#idl-Error>
- [17] [CITE[Web IDL (Second Edition)]] ([TIME[2015-05-27 01:29:33 +09:00]] 版) <http://heycam.github.io/webidl/#es-Error>
]REFS]
* 意味
[13] [[Web IDL]] の[[型]] [CODE(IDL)@en[[[Error]]]] は、
[[Web IDL]] [[例外]]を表します [SRC[>>9]]。
;; [14] [CODE(IDL)@en[[[DOMException]]]] も含まれます。
[CODE(IDL)@en[[[SyntaxError]]]] が含まれるのかは謎です。
[16] [[型名]]は、 [CODE(IDL)@en[[[Error]]]] です [SRC[>>15]]。
* サブクラス
[FIG(short list)[
- [CODE(JS)@en[[[EvalError]]]]
- [CODE(JS)@en[[[RangeError]]]]
- [CODE(JS)@en[[[ReferenceError]]]]
- [CODE(JS)@en[[[SyntaxError]]]]
- [CODE(JS)@en[[[TypeError]]]]
- [CODE(JS)@en[[[URIError]]]]
- [CODE(DOMi)@en[[[DOMException]]]]
]FIG]
* 単純例外
[10] [[Web IDL]] は、[[例外]]のうち次のものを[DFN[[RUBYB[[[単純例外]]]@en[simple exception]]]]と呼んでいます [SRC[>>9]]。
[FIG(short list)[
- [CODE(IDL)@en[[[EvalError]]]]
- [CODE(IDL)@en[[[RangeError]]]]
- [CODE(IDL)@en[[[ReferenceError]]]]
- [CODE(IDL)@en[[[TypeError]]]]
- [CODE(IDL)@en[[[URIError]]]]
]FIG]
[11] これらは [[JavaScript]] の [CODE(JS)@en[[[Error]]]] の[[部分クラス]]に相当します。
ただし [CODE(JS)@en[[[SyntaxError]]]] は[[JavaScript]]の[[構文解析]]のみに使うとして、
[CODE(JS)@en[Error]] 自体は[[著者]]が使うものであるとして、
除外されています。 [SRC[>>9]]
;; [12] 実際には [[DOM]] でも、 [[Worker]] の処理で [CODE(JS)@en[[[SyntaxError]]]]
を使っています (が [[JavaScript]] の[[構文解析]]に関するエラーを表すものです)。
* メンバー
[FIG(short list)[ [27] [CODE(JS)@en[Error]] の[[メンバー]]
- [CODE(JS)@en[name]]
- [CODE(JS)@en[message]]
- [CODE(JS)@en[toString]]
]FIG]
* 演算
[18] [[JavaScript]] 値から [CODE(IDL)@en[[[Error]]]] [[Web IDL値への変換]]は、
次のように定義されています [SRC[>>17]]。
[FIG(steps)[
= [19] 指定された値が [CODE(JS)@en[[[Object]]]] でないか、
[CODE[[[ErrorData]]]] [[内部スロット]]を持たないなら、
[CODE(JS)@en[[[TypeError]]]] を[[投げ]]、停止します。
= [20] 指定された値と同じオブジェクトを指す [[Web IDL]] [CODE(IDL)@en[[[Error]]]] 値を返します。
]FIG]
[21] [[Web IDL]] 値から [[JavaScript値への変換]]は、
次のように定義されています [SRC[>>17]]。
[FIG(steps)[
= [22] 指定された値と同じオブジェクトを指す [[JavaScript]] [CODE(JS)@en[[[Error]]]]
値を返します。
]FIG]
* 歴史
- [4] '''[CITE@en-GB[ECMAScript Language Specification ECMA-262 6th Edition – DRAFT]] ([TIME[2014-08-27 17:42:43 +09:00]] 版) <http://people.mozilla.org/~jorendorff/es6-draft.html#sec-error-objects>'''
[REFS[
- [1] [CITE@en-US[Error - JavaScript | MDN]]
( ([TIME[2012-10-29 12:26:49 +09:00]] 版))
<https://developer.mozilla.org/en/docs/JavaScript/Reference/Global_Objects/Error>
- [2] [CITE@en-us[Error Object (JavaScript)]]
( ([TIME[2012-11-25 02:45:06 +09:00]] 版))
<http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx>
- [3] [CITE@en-us[Error Object]]
( ([TIME[2012-11-25 02:44:09 +09:00]] 版))
<http://msdn.microsoft.com/en-us/library/vstudio/t9zk6eay(v=vs.100).aspx>
]REFS]
[5] [CITE[JavaScriptでカスラムエラーをどう作るか - rikubaの日記]]
( ([TIME[2014-04-10 02:13:58 +09:00]] 版))
<http://d.hatena.ne.jp/rikuba/20140409/1397031752>
[6] [CITE@en[Removed IDL exceptions, baked in DOMException, and added Error and DOMEx... · 50e172e · heycam/webidl]]
( ([TIME[2014-10-10 07:55:16 +09:00]] 版))
<https://github.com/heycam/webidl/commit/50e172ec079db073c3724c9beac1b576fb5dbc47>
[7] [CITE@en[DOMException is in IDL. DOMError removed. https://www.w3.org/Bugs/Public... · 7fe5736 · whatwg/dom]]
( ([TIME[2014-10-10 07:56:50 +09:00]] 版))
<https://github.com/whatwg/dom/commit/7fe5736d3ed2717d71a3d2627b07dee97e10ef05>
[8] [CITE@en[Removed IDL exceptions, baked in DOMException, and added Error and DOMEx... · 50e172e · heycam/webidl]]
( ([TIME[2014-10-10 07:57:10 +09:00]] 版))
<https://github.com/heycam/webidl/commit/50e172ec079db073c3724c9beac1b576fb5dbc47>
[23] [CITE@en[Write structured clone algorithm in terms of ECMAScript · whatwg/html@bfb960c]]
([TIME[2016-03-02 16:48:55 +09:00]] 版)
<https://github.com/whatwg/html/commit/bfb960c938580c95e77365e614218b952f96375b>
[24] [CITE@en[Exception cleanup (#250)]]
([[tobie]]著, [TIME[2016-12-13 18:46:16 +09:00]])
<https://github.com/heycam/webidl/commit/c2d602f15a60765832e52b9c4a62f7ae76b2950c>
[25] [CITE@en[Clarify that exceptions are always thrown in the current Realm (#300)]]
([[domenic]]著, [TIME[2017-02-07 15:56:01 +09:00]])
<https://github.com/heycam/webidl/commit/20b87a7d44d94a153762a5c1c587779767afbfe6>
[28] [CITE@en[DOMException function definition makes no sense · Issue #55 · heycam/webidl]]
([TIME[2017-08-21 22:39:41 +09:00]])
<https://github.com/heycam/webidl/issues/55>
[29] [CITE@en[tc39/proposal-error-stacks: ECMAScript Proposal, specs, and reference implementation for Error.prototype.stack / System.getStack]]
([TIME[2017-08-21 22:51:33 +09:00]])
<https://github.com/tc39/proposal-error-stacks>
[30] [CITE@en[Use `DOMException` instead of `Error` in `SensorErrorEvent`]]
([[pozdnyakov]]著, [TIME[2017-10-11 22:42:19 +09:00]])
<https://github.com/w3c/sensors/commit/810d1a9b646585d954f4798e227cbf218a2ff9eb>
[31] [CITE@en[Remove the Error IDL type]]
([[Ms2ger]]著, [TIME[2019-05-17 22:52:31 +09:00]])
<https://github.com/heycam/webidl/commit/ad03037c82890e7ac496b96922552f465c45c0a7>
[32] [CITE@en[Remove the Error IDL type]]
([[Ms2ger]]著, [TIME[2019-05-17 22:52:31 +09:00]])
<https://github.com/heycam/webidl/commit/ad03037c82890e7ac496b96922552f465c45c0a7>
[33] [CITE@en[Remove the Error IDL type by Ms2ger · Pull Request #728 · heycam/webidl]]
([TIME[2020-01-12 14:12:28 +09:00]])
<https://github.com/heycam/webidl/pull/728>
[34] [CITE@en[Remove the 'exception types' definition]]
([[Ms2ger]]著, [TIME[2019-05-17 23:21:01 +09:00]])
<https://github.com/heycam/webidl/commit/faaee577b0c0c03338b139754835ac999de507be>