-
Notifications
You must be signed in to change notification settings - Fork 4
/
793.txt
45 lines (32 loc) · 2.36 KB
/
793.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
* 仕様書
[REFS[
- [3] [CITE[Web IDL (Second Edition)]] ([TIME[2015-05-27 01:29:33 +09:00]] 版) <http://heycam.github.io/webidl/#dfn-exception>
- [7] [CITE[Web IDL (Second Edition)]] ([TIME[2015-05-27 01:29:33 +09:00]] 版) <http://heycam.github.io/webidl/#dfn-current-global-environment>
]REFS]
* 演算
[4] [[例外]]は、[[エラー名]]を指定して[DFN[[RUBYB[投げる]@en[throw]]]]ことができます [SRC[>>3]]。
その動作は[[言語束縛]]により決まります [SRC[>>3]]。
[6] [[JavaScript]] においては、指定された[[エラー名]]や[[利用者エージェント]]依存の[[メッセージ (例外)]]
によって[[例外を作成]]し、それを[[投げる]]ようにしなければ[['''なりません''']] [SRC[>>7]]。
[8] [[Web IDL]] 仕様内で [[JavaScript]] 組み込みの [CODE(JS)@en[[[Error]]]]
を[[投げる]]というときは、[[現在大域環境]]の組み込みオブジェクトを使わなければ[['''なりません''']]
[SRC[>>7]]。
[9] [[Web IDL]] [[JavaScript]] 束縛が [CODE(JS)@en[[[Function]]]] を呼び出し、
[[例外]]が投げられた場合、 [[Web IDL]] 束縛としてはそれをそのまま伝播するので、
呼び出し元へと順に伝播することになります。 [SRC[>>7]]
* 歴史
[1] [CITE@en-us[throw Statement - MDC Doc Center]]
([TIME[2010-12-15 16:20:53 +09:00]] 版)
<https://developer.mozilla.org/ja/JavaScript/Guide/Exception_Handling_Statements/throw_Statement>
[2] [[WinIE]] では [CODE(JS)@en[[[throw]]]] は [CODE(JS)@en[[[try]]]] 内でないと構文エラーになる、
と思いきやならなかったりもしてよくわかりませんねぇ。
[5] 例外は発生 ([DFN[raise]]) するとも言われることがあります。
[10] [CITE@en[Editorial: change wording for throwing DOMExceptions]]
( ([[domenic]]著, [TIME[2016-05-06 05:19:47 +09:00]]))
<https://github.com/whatwg/html/commit/3ac179e4e7626f11cb37690fb0f5f44972f58a48>
[11] [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>
[12] [CITE@en[Editorial: remove "rethrow" per Infra]]
([[annevk]]著, [TIME[2017-09-04 18:11:21 +09:00]])
<https://github.com/whatwg/fetch/commit/829e56dd47534b8e6725ce0c56c5bdea6e23d222>