@tryghost/errors 1.2.15 → 1.2.17
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/lib/utils.js +7 -3
- package/package.json +4 -4
package/lib/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const omit = require('lodash/omit');
|
|
2
2
|
const merge = require('lodash/merge');
|
|
3
3
|
const extend = require('lodash/extend');
|
|
4
|
-
const
|
|
4
|
+
const deepCopy = require('@stdlib/utils/copy');
|
|
5
5
|
const _private = {};
|
|
6
6
|
|
|
7
7
|
_private.serialize = function serialize(err) {
|
|
@@ -195,7 +195,7 @@ exports.prepareStackForUser = function prepareStackForUser(error) {
|
|
|
195
195
|
stackbits.splice(1, 0, `Stack Trace:`);
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
// Add in our custom
|
|
198
|
+
// Add in our custom context and help methods
|
|
199
199
|
if (error.help) {
|
|
200
200
|
stackbits.splice(1, 0, `${error.help}`);
|
|
201
201
|
}
|
|
@@ -204,7 +204,11 @@ exports.prepareStackForUser = function prepareStackForUser(error) {
|
|
|
204
204
|
stackbits.splice(1, 0, `${error.context}`);
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
|
|
207
|
+
// @NOTE: would be a good idea to swap out the cloning implementation with native
|
|
208
|
+
// `structuredClone` one once we use Node v17 or higher. Before making an
|
|
209
|
+
// upgrade make sure structuredClone does a full copy of all properties
|
|
210
|
+
// present on a custom error (see issue: https://github.com/ungap/structured-clone/issues/12)
|
|
211
|
+
const errorClone = deepCopy(error);
|
|
208
212
|
errorClone.stack = stackbits.join('\n');
|
|
209
213
|
return errorClone;
|
|
210
214
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryghost/errors",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.17",
|
|
4
4
|
"repository": "https://github.com/TryGhost/framework/tree/main/packages/errors",
|
|
5
5
|
"author": "Ghost Foundation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"sinon": "14.0.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
+
"@stdlib/utils": "^0.0.12",
|
|
28
29
|
"lodash": "^4.17.21",
|
|
29
|
-
"
|
|
30
|
-
"uuid": "^8.3.2"
|
|
30
|
+
"uuid": "^9.0.0"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "61b78c6f72ae5766794ae7a32bac09d909d8e938"
|
|
33
33
|
}
|