@common.js/serialize-error 11.0.1 → 11.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.js +6 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
The [serialize-error](https://www.npmjs.com/package/serialize-error) package exported as CommonJS modules.
|
|
4
4
|
|
|
5
|
-
Exported from [serialize-error@11.0.
|
|
5
|
+
Exported from [serialize-error@11.0.2](https://www.npmjs.com/package/serialize-error/v/11.0.2) using https://github.com/etienne-martin/common.js.
|
package/index.js
CHANGED
|
@@ -358,7 +358,10 @@ var destroyCircular = function(param) {
|
|
|
358
358
|
continue;
|
|
359
359
|
}
|
|
360
360
|
if (!value || typeof value !== "object") {
|
|
361
|
-
|
|
361
|
+
// Gracefully handle non-configurable errors like `DOMException`.
|
|
362
|
+
try {
|
|
363
|
+
to[key] = value;
|
|
364
|
+
} catch (e) {}
|
|
362
365
|
continue;
|
|
363
366
|
}
|
|
364
367
|
if (!seen.includes(from[key])) {
|
|
@@ -427,9 +430,9 @@ function serializeError(value) {
|
|
|
427
430
|
}
|
|
428
431
|
// People sometimes throw things besides Error objects…
|
|
429
432
|
if (typeof value === "function") {
|
|
430
|
-
var _name;
|
|
431
433
|
// `JSON.stringify()` discards functions. We do too, unless a function is thrown directly.
|
|
432
|
-
|
|
434
|
+
// We intentionally use `||` because `.name` is an empty string for anonymous functions.
|
|
435
|
+
return "[Function: ".concat(value.name || "anonymous", "]");
|
|
433
436
|
}
|
|
434
437
|
return value;
|
|
435
438
|
}
|