diff options
| author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
|---|---|---|
| committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
| commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
| tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/javascript/reference/global_objects/aggregateerror | |
| parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
| download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip | |
initial commit
Diffstat (limited to 'files/ja/web/javascript/reference/global_objects/aggregateerror')
| -rw-r--r-- | files/ja/web/javascript/reference/global_objects/aggregateerror/aggregateerror/index.html | 69 | ||||
| -rw-r--r-- | files/ja/web/javascript/reference/global_objects/aggregateerror/index.html | 88 |
2 files changed, 157 insertions, 0 deletions
diff --git a/files/ja/web/javascript/reference/global_objects/aggregateerror/aggregateerror/index.html b/files/ja/web/javascript/reference/global_objects/aggregateerror/aggregateerror/index.html new file mode 100644 index 0000000000..f98f2de7c4 --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/aggregateerror/aggregateerror/index.html @@ -0,0 +1,69 @@ +--- +title: AggregateError() constructor +slug: Web/JavaScript/Reference/Global_Objects/AggregateError/AggregateError +tags: + - Constructor + - JavaScript + - Reference +translation_of: Web/JavaScript/Reference/Global_Objects/AggregateError/AggregateError +--- +<div>{{JSRef}}</div> + +<p><code><strong>AggregateError()</strong></code> コンストラクタは、単一のエラーにラップする必要があるいくつかのエラーに対してエラーを作成します。</p> + +<h2 id="構文">構文</h2> + +<pre class="syntaxbox notranslate">new AggregateError(errors[, message])</pre> + +<h3 id="値">値</h3> + +<dl> + <dt><code>errors</code></dt> + <dd>エラーの反復可能であり、実際には {{JSxRef("Error")}} インスタンスではない場合があります。</dd> + <dt><code>message</code>{{Optional_Inline}}</dt> + <dd>集計エラーのオプションのヒューマンリーダブルの説明。</dd> +</dl> + +<h2 id="例">例</h2> + +<h3 id="AggregateError_の作成"><code>AggregateError</code> の作成</h3> + +<pre class="brush: js; notranslate">try { + throw new AggregateError([ + new Error("some error"), + ], 'Hello'); +} catch (e) { + console.log(e instanceof AggregateError); // true + console.log(e.message); // "Hello" + console.log(e.name); // "AggregateError" + console.log(e.errors); // [ Error: "some error" ] +}</pre> + +<h2 id="仕様">仕様</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">仕様</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('Promise.any', '#sec-aggregate-error-constructor', 'AggregateError()')}}</td> + </tr> + </tbody> +</table> + +<h2 id="ブラウザー実装状況">ブラウザー実装状況</h2> + +<div> + + +<p>{{Compat("javascript.builtins.AggregateError.AggregateError")}}</p> +</div> + +<h2 id="関連項目">関連項目</h2> + +<ul> + <li>{{jsxref("Promise.any")}}</li> +</ul> diff --git a/files/ja/web/javascript/reference/global_objects/aggregateerror/index.html b/files/ja/web/javascript/reference/global_objects/aggregateerror/index.html new file mode 100644 index 0000000000..d9e0e018e9 --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/aggregateerror/index.html @@ -0,0 +1,88 @@ +--- +title: AggregateError +slug: Web/JavaScript/Reference/Global_Objects/AggregateError +tags: + - AggregateError + - Class + - Experimental + - Interface + - JavaScript + - クラス +translation_of: Web/JavaScript/Reference/Global_Objects/AggregateError +--- +<div>{{JSRef}}</div> + +<p><code><strong>AggregateError</strong></code> オブジェクトは、複数のエラーを1つのエラーにまとめる必要があるときのエラーを表します。これは一つの操作で複数のエラーを報告する必要があるときに発生します。例えば {{JSxRef("Promise.any()")}} において、渡されたすべてのプロミスが拒否された場合などです。</p> + +<h2 id="Constructor" name="Constructor">コンストラクター</h2> + +<dl> + <dt>{{jsxref("Global_Objects/AggregateError/AggregateError", "AggregateError()")}}</dt> + <dd>新しい <code>AggregateError</code> オブジェクトを生成します。</dd> +</dl> + +<h2 id="Instance_properties" name="Instance_properties">インスタンスプロパティ</h2> + +<dl> + <dt>{{JSxRef("Error.prototype.message", "AggregateError.prototype.message")}}</dt> + <dd>エラーメッセージで、既定値は <code>""</code> です。</dd> + <dt>{{JSxRef("Error.prototype.name", "AggregateError.prototype.name")}}</dt> + <dd>エラー名で、既定値は <code>AggregateError</code> です。</dd> +</dl> + +<h2 id="Examples" name="Examples">例</h2> + +<h3 id="Catching_an_AggregateError" name="Catching_an_AggregateError">AggregateError の捕捉</h3> + +<pre class="brush: js; notranslate">Promise.any([ + Promise.reject(new Error("some error")), +]).catch(e => { + console.log(e instanceof AggregateError); // true + console.log(e.message); // "All Promises rejected" + console.log(e.name); // "AggregateError" + console.log(e.errors); // [ Error: "some error" ] +}); +</pre> + +<h3 id="Creating_an_AggregateError" name="Creating_an_AggregateError">AggregateError の生成</h3> + +<pre class="brush: js; notranslate">try { + throw new AggregateError([ + new Error("some error"), + ], 'Hello'); +} catch (e) { + console.log(e instanceof AggregateError); // true + console.log(e.message); // "Hello" + console.log(e.name); // "AggregateError" + console.log(e.errors); // [ Error: "some error" ] +} +</pre> + +<h2 id="Specifications" name="Specifications">仕様書</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">仕様書</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('Promise.any', '#sec-aggregate-error-object-structure', 'AggregateError')}}</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2> + +<div> +<div class="hidden">このページの互換性一覧表は構造化データから生成されています。データに協力していただけるのであれば、 <a class="external" href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> をチェックアウトしてプルリクエストを送信してください。</div> + +<p>{{Compat("javascript.builtins.AggregateError")}}</p> +</div> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li>{{JSxRef("Error")}}</li> +</ul> |
