diff --git a/packages/errors/src/error-handler.js b/packages/errors/src/error-handler.js index 936a2c711..2753941b7 100644 --- a/packages/errors/src/error-handler.js +++ b/packages/errors/src/error-handler.js @@ -19,7 +19,7 @@ export default function(options = {}) { } return function(error, req, res, next) { - if ( !(error instanceof errors.FeathersError) ) { + if (error.type !== 'FeathersError') { let oldError = error; error = new errors.GeneralError(oldError.message, { errors: oldError.errors diff --git a/packages/errors/src/index.js b/packages/errors/src/index.js index 5b27497b8..36a6aeb29 100644 --- a/packages/errors/src/index.js +++ b/packages/errors/src/index.js @@ -50,6 +50,7 @@ class FeathersError extends Error { // NOTE (EK): Babel doesn't support this so // we have to pass in the class name manually. // this.name = this.constructor.name; + this.type = 'FeathersError'; this.name = name; this.message = message; this.code = code;