From 188b7f343dcbb050add6b58d46b0ba8a3a45c32e Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Sun, 12 Sep 2021 22:33:57 +0900 Subject: Global_Objects/WebAssembly/CompileError を更新 (#2331) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Markdownに変換 - 2021/07/21 時点の英語版に同期 - コンストラクターについては新規翻訳 --- .../webassembly/compileerror/compileerror/index.md | 66 +++++++++++++ .../webassembly/compileerror/index.html | 110 --------------------- .../webassembly/compileerror/index.md | 78 +++++++++++++++ 3 files changed, 144 insertions(+), 110 deletions(-) create mode 100644 files/ja/web/javascript/reference/global_objects/webassembly/compileerror/compileerror/index.md delete mode 100644 files/ja/web/javascript/reference/global_objects/webassembly/compileerror/index.html create mode 100644 files/ja/web/javascript/reference/global_objects/webassembly/compileerror/index.md diff --git a/files/ja/web/javascript/reference/global_objects/webassembly/compileerror/compileerror/index.md b/files/ja/web/javascript/reference/global_objects/webassembly/compileerror/compileerror/index.md new file mode 100644 index 0000000000..26fa3f0799 --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/webassembly/compileerror/compileerror/index.md @@ -0,0 +1,66 @@ +--- +title: WebAssembly.CompileError() コンストラクター +slug: Web/JavaScript/Reference/Global_Objects/WebAssembly/CompileError/CompileError +tags: + - Constructor + - JavaScript + - Reference + - WebAssembly +browser-compat: javascript.builtins.WebAssembly.CompileError.CompileError +translation_of: Web/JavaScript/Reference/Global_Objects/WebAssembly/CompileError/CompileError +--- +{{JSRef}} + +**`WebAssembly.CompileError()`** コンストラクターは、新しい WebAssembly の `CompileError` オブジェクトを生成します。これは WebAssembly のデコードまたは検証中のエラーを示します。 + +## 構文 + +```js +new WebAssembly.CompileError() +new WebAssembly.CompileError(message) +new WebAssembly.CompileError(message, fileName) +new WebAssembly.CompileError(message, fileName, lineNumber) +``` + +### 引数 + +- `message` {{optional_inline}} + - : このエラーの人間が読める説明です。 +- `fileName` {{optional_inline}} + - : 例外が発生したコードを含むファイル名です。 +- `lineNumber` {{optional_inline}} + - : 例外が発生したコードの行番号です。 + +## 例 + +### 新しい CompileError インスタンスの生成 + +以下のスニペットは新しい `CompileError` のインスタンスを生成し、コンソールに詳細を記録します。 + +```js +try { + throw new WebAssembly.CompileError('Hello', 'someFile', 10); +} catch (e) { + console.log(e instanceof CompileError); // true + console.log(e.message); // "Hello" + console.log(e.name); // "CompileError" + 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) diff --git a/files/ja/web/javascript/reference/global_objects/webassembly/compileerror/index.html b/files/ja/web/javascript/reference/global_objects/webassembly/compileerror/index.html deleted file mode 100644 index 785e7f604e..0000000000 --- a/files/ja/web/javascript/reference/global_objects/webassembly/compileerror/index.html +++ /dev/null @@ -1,110 +0,0 @@ ---- -title: WebAssembly.CompileError() -slug: Web/JavaScript/Reference/Global_Objects/WebAssembly/CompileError -translation_of: Web/JavaScript/Reference/Global_Objects/WebAssembly/CompileError ---- -
{{JSRef}} {{SeeCompatTable}}
- -

WebAssembly.CompileError() コンストラクタは WebAssembly CompileError オブジェクトを生成します。WebAssembly のデコードやバリデーション中にエラーが発生したことを示します。

- -

構文

- -
new WebAssembly.CompileError(message, fileName, lineNumber)
- -

パラメータ

- -
-
message {{optional_inline}}
-
ヒューマンリーダブルなエラーの説明。
-
fileName {{optional_inline}}{{non-standard_inline}}
-
例外の原因となったコードを含むファイルの名前。
-
lineNumber {{optional_inline}}{{non-standard_inline}}
-
例外の原因となったコードの行番号。
-
- -

プロパティ

- -

CompileError コンストラクタは自身のプロパティを持ちませんが、プロトタイプチェーンを通していくつかのプロパティを継承します。

- -
-
WebAssembly.CompileError.prototype.constructor
-
インスタンスのプロトタイプを生成した関数を示します。
-
{{jsxref("Error.prototype.message", "WebAssembly.CompileError.prototype.message")}}
-
エラーメッセージ。ECMA-262では {{jsxref("URIError")}} は自身の message プロパティを提供する必要がありますが、SpiderMonkey では {{jsxref("Error.prototype.message")}} を継承します。
-
{{jsxref("Error.prototype.name", "WebAssembly.CompileError.prototype.name")}}
-
エラー名。{{jsxref("Error")}} から継承されます。
-
{{jsxref("Error.prototype.fileName", "WebAssembly.CompileError.prototype.fileName")}}
-
このエラーを発生させたファイルのパス。 {{jsxref("Error")}} から継承されます。
-
{{jsxref("Error.prototype.lineNumber", "WebAssembly.CompileError.prototype.lineNumber")}}
-
このエラーを発生させたファイルの行番号。{{jsxref("Error")}} から継承されます。
-
{{jsxref("Error.prototype.columnNumber", "WebAssembly.CompileError.prototype.columnNumber")}}
-
このエラーが発生した行の列番号。{{jsxref("Error")}} から継承されます。
-
{{jsxref("Error.prototype.stack", "WebAssembly.CompileError.prototype.stack")}}
-
スタックトレース。{{jsxref("Error")}} から継承されます。
-
- -

メソッド

- -

CompileError コンストラクタは自身のメソッドを持ちませんが、プロトタイプチェーンを通していくつかのメソッドを継承します。

- -
-
{{jsxref("Error.prototype.toSource", "WebAssembly.CompileError.prototype.toSource()")}}
-
同じエラーを評価できるコードを返します。{{jsxref("Error")}} から継承されます。
-
{{jsxref("Error.prototype.toString", "WebAssembly.CompileError.prototype.toString()")}}
-
指定された Error オブジェクトを表す文字列を返します。{{jsxref("Error")}} から継承されます。
-
- -

- -

以下のスニペットで CompileError インスタンスを生成して、詳細をコンソールに表示します。

- -
try {
-  throw new WebAssembly.CompileError('Hello', 'someFile', 10);
-} catch (e) {
-  console.log(e instanceof CompileError); // true
-  console.log(e.message);                 // "Hello"
-  console.log(e.name);                    // "CompileError"
-  console.log(e.fileName);                // "someFile"
-  console.log(e.lineNumber);              // 10
-  console.log(e.columnNumber);            // 0
-  console.log(e.stack);                   // コードが実行された場所を返す
-}
- -

仕様

- - - - - - - - - - - - - - - - - - - - - -
仕様策定状況コメント
{{SpecName('WebAssembly JS', '#constructor-properties-of-the-webassembly-object', 'WebAssembly constructors')}}{{Spec2('WebAssembly JS')}}WebAssembly の初回ドラフト定義。
{{SpecName('ESDraft', '#sec-native-error-types-used-in-this-standard', 'NativeError')}}{{Spec2('ESDraft')}}標準の NativeError 型の定義。
- -

ブラウザ実装状況

- -
{{Compat("javascript.builtins.WebAssembly.CompileError")}}
- -

関連情報

- - - -
-
diff --git a/files/ja/web/javascript/reference/global_objects/webassembly/compileerror/index.md b/files/ja/web/javascript/reference/global_objects/webassembly/compileerror/index.md new file mode 100644 index 0000000000..e851a74a2a --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/webassembly/compileerror/index.md @@ -0,0 +1,78 @@ +--- +title: WebAssembly.CompileError +slug: Web/JavaScript/Reference/Global_Objects/WebAssembly/CompileError +tags: + - API + - Class + - CompileError + - JavaScript + - NativeError + - Reference + - WebAssembly +browser-compat: javascript.builtins.WebAssembly.CompileError +translation_of: Web/JavaScript/Reference/Global_Objects/WebAssembly/CompileError +--- +{{JSRef}} + +**`WebAssembly.CompileError`** オブジェクトは、 WebAssembly のデコードや検証の間のエラーを示します。 + +## コンストラクター + +- [`WebAssembly.CompileError()`](/ja/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/CompileError/CompileError) + - : 新しい `WebAssembly.CompileError` オブジェクトを生成します。 + +## インスタンスプロパティ + +- {{jsxref("Error.prototype.message", "WebAssembly.CompileError.prototype.message")}} + - : エラーメッセージ。 {{jsxref("Error")}} から継承しています。 +- {{jsxref("Error.prototype.name", "WebAssembly.CompileError.prototype.name")}} + - : エラー名。 {{jsxref("Error")}} から継承しています。 +- {{jsxref("Error.prototype.fileName", "WebAssembly.CompileError.prototype.fileName")}} + - : このエラーを発生させたファイルのパス。 {{jsxref("Error")}} から継承しています。 +- {{jsxref("Error.prototype.lineNumber", "WebAssembly.CompileError.prototype.lineNumber")}} + - : このエラーを発生させたファイルの行番号。 {{jsxref("Error")}} から継承しています。 +- {{jsxref("Error.prototype.columnNumber", "WebAssembly.CompileError.prototype.columnNumber")}} + - : このエラーが発生した行の列番号。 {{jsxref("Error")}} から継承しています。 +- {{jsxref("Error.prototype.stack", "WebAssembly.CompileError.prototype.stack")}} + - : スタックトレース。 {{jsxref("Error")}} から継承しています。 + +## インスタンスメソッド + +- {{jsxref("Error.prototype.toSource", "WebAssembly.CompileError.prototype.toSource()")}} + - : 同じエラーを評価できるコードを返します。 {{jsxref("Error")}} から継承しています。 +- {{jsxref("Error.prototype.toString", "WebAssembly.CompileError.prototype.toString()")}} + - : 指定された `Error` オブジェクトを表す文字列を返します。{{jsxref("Error")}} から継承しています。 + +## 例 + +### 新しい CompileError のインスタンスの作成 + +以下のスニペットでは、新しい `CompileError` インスタンスを生成して、詳細をコンソールに記録します。 + +```js +try { + throw new WebAssembly.CompileError('Hello', 'someFile', 10); +} catch (e) { + console.log(e instanceof CompileError); // true + console.log(e.message); // "Hello" + console.log(e.name); // "CompileError" + 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) -- cgit v1.2.3-54-g00ecf