mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
assert: differentiate cases where cause is undefined or missing
PR-URL: https://github.com/nodejs/node/pull/55738 Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
1 parent
979526fd99
commit
6af5c4e2b4
3 files changed
+52
-5
No files matched your search
@@ -9,6 +9,7 @@ const {
|
||||
ObjectAssign,
|
||||
ObjectDefineProperty,
|
||||
ObjectGetPrototypeOf,
|
||||
ObjectPrototypeHasOwnProperty,
|
||||
String,
|
||||
StringPrototypeRepeat,
|
||||
StringPrototypeSlice,
|
||||
@@ -49,8 +50,8 @@ function copyError(source) {
|
||||
__proto__: null,
|
||||
value: source.message,
|
||||
});
|
||||
if (source.cause !== undefined) {
|
||||
let cause = source.cause;
|
||||
if (ObjectPrototypeHasOwnProperty(source, 'cause')) {
|
||||
let { cause } = source;
|
||||
|
||||
if (isError(cause)) {
|
||||
cause = copyError(cause);
|
||||
|
||||
Reference in new issue
Block a user