blob: fb4adc12fe9361e80666517ab8c8e1e7918f72a6 (
plain)
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
|
---
title: WebAssembly.LinkError
slug: Web/JavaScript/Reference/Global_Objects/WebAssembly/LinkError
tags:
- API
- Class
- JavaScript
- LinkError
- Reference
- WebAssembly
browser-compat: javascript.builtins.WebAssembly.LinkError
translation_of: Web/JavaScript/Reference/Global_Objects/WebAssembly/LinkError
---
{{JSRef}}
**`WebAssembly.RuntimeLinkError`** オブジェクトは、モジュールのインスタンス化の際に発生したエラーを示します (開始した関数での[トラップ](https://webassembly.org/docs/semantics/#traps)を除く)。
## コンストラクター
- [`WebAssembly.LinkError()`](/ja/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/LinkError/LinkError)
- : 新しい `WebAssembly.LinkError` オブジェクトを生成します。
## インスタンスプロパティ
- {{jsxref("Error.prototype.message", "WebAssembly.LinkError.prototype.message")}}
- : エラーメッセージ。 {{jsxref("Error")}} から継承しています。
- {{jsxref("Error.prototype.name", "WebAssembly.LinkError.prototype.name")}}
- : エラー名。 {{jsxref("Error")}} から継承しています。
- {{jsxref("Error.prototype.fileName", "WebAssembly.LinkError.prototype.fileName")}}
- : このエラーを発生させたファイルのパス。 {{jsxref("Error")}} から継承しています。
- {{jsxref("Error.prototype.lineNumber", "WebAssembly.LinkError.prototype.lineNumber")}}
- : このエラーを発生させたファイルの行番号。 {{jsxref("Error")}} から継承しています。
- {{jsxref("Error.prototype.columnNumber", "WebAssembly.LinkError.prototype.columnNumber")}}
- : このエラーが発生した行の列番号。 {{jsxref("Error")}} から継承しています。
- {{jsxref("Error.prototype.stack", "WebAssembly.LinkError.prototype.stack")}}
- : スタックトレース。 {{jsxref("Error")}} から継承しています。
## インスタンスメソッド
- {{jsxref("Error.prototype.toSource", "WebAssembly.LinkError.prototype.toSource()")}}
- : 同じエラーを評価できるコードを返します。 {{jsxref("Error")}} から継承しています。
- {{jsxref("Error.prototype.toString", "WebAssembly.LinkError.prototype.toString()")}}
- : 指定された `Error` オブジェクトを表す文字列を返します。{{jsxref("Error")}} から継承しています。
## 例
### 新しい LinkError のインスタンスの作成
以下のスニペットでは、新しい `LinkError` インスタンスを生成して、詳細をコンソールに記録します。
```js
try {
throw new WebAssembly.LinkError('Hello', 'someFile', 10);
} catch (e) {
console.log(e instanceof LinkError); // true
console.log(e.message); // "Hello"
console.log(e.name); // "LinkError"
console.log(e.fileName); // "someFile"
console.log(e.lineNumber); // 10
console.log(e.columnNumber); // 0
console.log(e.stack); // コードが実行されていた位置を返す
}
```
## 仕様書
{{Specifications}}
## ブラウザーの互換性
{{Compat}}
## 関連情報
- [WebAssembly](/ja/docs/WebAssembly) 概要ページ
- [WebAssembly の概念](/ja/docs/WebAssembly/Concepts)
- [WebAssembly JavaScript API の使用](/ja/docs/WebAssembly/Using_the_JavaScript_API)
|