@tryghost/errors 1.0.0 → 1.0.4
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/errors.js +14 -3
- package/lib/utils.js +2 -1
- package/package.json +4 -3
package/lib/errors.js
CHANGED
|
@@ -290,12 +290,23 @@ const ghostErrors = {
|
|
|
290
290
|
level: 'critical'
|
|
291
291
|
}, options));
|
|
292
292
|
}
|
|
293
|
+
},
|
|
294
|
+
NoContentError: class NoContentError extends GhostError {
|
|
295
|
+
constructor(options) {
|
|
296
|
+
super(merge({
|
|
297
|
+
errorType: 'NoContentError',
|
|
298
|
+
statusCode: 204,
|
|
299
|
+
hideStack: true
|
|
300
|
+
}, options));
|
|
301
|
+
}
|
|
293
302
|
}
|
|
294
303
|
};
|
|
295
304
|
|
|
296
305
|
module.exports = ghostErrors;
|
|
306
|
+
|
|
307
|
+
const ghostErrorsWithBase = Object.assign({}, ghostErrors, {GhostError});
|
|
297
308
|
module.exports.utils = {
|
|
298
|
-
serialize: utils.serialize.bind(
|
|
299
|
-
deserialize: utils.deserialize.bind(
|
|
300
|
-
isGhostError: utils.isGhostError.bind(
|
|
309
|
+
serialize: utils.serialize.bind(ghostErrorsWithBase),
|
|
310
|
+
deserialize: utils.deserialize.bind(ghostErrorsWithBase),
|
|
311
|
+
isGhostError: utils.isGhostError.bind(ghostErrorsWithBase)
|
|
301
312
|
};
|
package/lib/utils.js
CHANGED
|
@@ -182,6 +182,7 @@ exports.deserialize = function deserialize(errorFormat) {
|
|
|
182
182
|
*/
|
|
183
183
|
exports.isGhostError = function isGhostError(err) {
|
|
184
184
|
const errorName = this.GhostError.name;
|
|
185
|
+
const legacyErrorName = 'IgnitionError';
|
|
185
186
|
|
|
186
187
|
const recursiveIsGhostError = function recursiveIsGhostError(obj) {
|
|
187
188
|
// no super constructor available anymore
|
|
@@ -189,7 +190,7 @@ exports.isGhostError = function isGhostError(err) {
|
|
|
189
190
|
return false;
|
|
190
191
|
}
|
|
191
192
|
|
|
192
|
-
if (obj.name === errorName) {
|
|
193
|
+
if (obj.name === errorName || obj.name === legacyErrorName) {
|
|
193
194
|
return true;
|
|
194
195
|
}
|
|
195
196
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryghost/errors",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"repository": "https://github.com/TryGhost/Utils/tree/main/packages/errors",
|
|
5
5
|
"author": "Ghost Foundation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"sinon": "11.1.2"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"lodash": "^4.17.21"
|
|
28
|
+
"lodash": "^4.17.21",
|
|
29
|
+
"uuid": "^8.3.2"
|
|
29
30
|
},
|
|
30
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "646fbc5aac374659c3a469ecf99dc5defb1901cf"
|
|
31
32
|
}
|