| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Error/cause | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
This feature is well established and works across many devices and browser versions. Its been available across browsers since 2021 9.
Error cause .
.
options.cause Error() . .
Property attributes of Error: cause | |
|---|---|
. catch Error cause Error . " " cause .
. Error .
try {
connectToDatabase();
} catch (err) {
throw new Error("Connecting to database failed.", { cause: err });
}
Error > Differentiate between similar errors .
. . , .
function makeRSA(p, q) {
if (!Number.isInteger(p) || !Number.isInteger(q)) {
throw new Error("RSA key generation requires integer inputs.", {
cause: { code: "NonInteger", values: [p, q] },
});
}
if (!areCoprime(p, q)) {
throw new Error("RSA key generation requires two co-prime integers.", {
cause: { code: "NonCoprime", values: [p, q] },
});
}
// rsa algorithm
}
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-installerrorcause |
This page was last modified on 2024 9 22 by MDN contributors.
ErrorObject/FunctionObject.prototype.__defineGetter__()Object.prototype.__defineSetter__()Object.prototype.__lookupGetter__()Object.prototype.__lookupSetter__()Object.prototype.hasOwnProperty()Object.prototype.isPrototypeOf()Object.prototype.propertyIsEnumerable()Object.prototype.toLocaleString()Object.prototype.toString()Object.prototype.valueOf()AggregateErrorEvalErrorInternalErrorRangeErrorReferenceErrorSyntaxErrorTypeErrorURIErrorYour blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |