diff options
Diffstat (limited to 'files/ko/web/javascript/reference/global_objects/aggregateerror/index.html')
-rw-r--r-- | files/ko/web/javascript/reference/global_objects/aggregateerror/index.html | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/files/ko/web/javascript/reference/global_objects/aggregateerror/index.html b/files/ko/web/javascript/reference/global_objects/aggregateerror/index.html new file mode 100644 index 0000000000..b83db1139e --- /dev/null +++ b/files/ko/web/javascript/reference/global_objects/aggregateerror/index.html @@ -0,0 +1,87 @@ +--- +title: AggregateError +slug: Web/JavaScript/Reference/Global_Objects/AggregateError +tags: + - AggregateError + - 실험적 + - 인터페이스 + - 자바스크립트 + - 클래스 +translation_of: Web/JavaScript/Reference/Global_Objects/AggregateError +--- +<div>{{JSRef}}</div> + +<p><code><strong>AggregateError</strong></code> 객체는 다수의 에러가 한 에러로 랩핑되어야 할 때의 오류를 나타냅니다. 한 작업에서 여러개의 오류가 보고될 때 발생하는데, 대표적으로 {{JSxRef("Promise.any()")}}에 전달된 모든 promise들이 거부되었을 때 발생합니다.</p> + +<h2 id="Constructor">Constructor</h2> + +<dl> + <dt>{{jsxref("Global_Objects/AggregateError/AggregateError", "AggregateError()")}}</dt> + <dd>새로운 <code>AggregateError</code> 객체를 생성합니다.</dd> +</dl> + +<h2 id="Instance_properties">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">Examples</h2> + +<h3 id="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="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">Specifications</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('Promise.any', '#sec-aggregate-error-objects', 'AggregateError')}}</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<div> + + +<p>{{Compat("javascript.builtins.AggregateError")}}</p> +</div> + +<h2 id="See_also">See also</h2> + +<ul> + <li>{{JSxRef("Error")}}</li> +</ul> |