MCPcopy Index your code
hub / github.com/nodejs/node / copyError

Function copyError

lib/internal/assert/assertion_error.js:51–70  ·  view source on GitHub ↗
(source)

Source from the content-addressed store, hash-verified

49 .add('partialDeepStrictEqual');
50
51function copyError(source) {
52 const target = ObjectAssign(
53 { __proto__: ObjectGetPrototypeOf(source) },
54 source,
55 );
56 ObjectDefineProperty(target, 'message', {
57 __proto__: null,
58 value: source.message,
59 });
60 if (ObjectPrototypeHasOwnProperty(source, 'cause')) {
61 let { cause } = source;
62
63 if (isError(cause)) {
64 cause = copyError(cause);
65 }
66
67 ObjectDefineProperty(target, 'cause', { __proto__: null, value: cause });
68 }
69 return target;
70}
71
72function inspectValue(val) {
73 // The util.inspect default values could be changed. This makes sure the

Callers 1

constructorMethod · 0.85

Calls 2

ObjectAssignFunction · 0.85
isErrorFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…