Merge pull request #28 from feathersjs/explicit-error-type

adding an explicit error type
This commit is contained in:
Eric Kryski 2016-02-24 14:02:31 -07:00 committed by David Luecke
parent e2960c41cc
commit c753a3ee89
2 changed files with 2 additions and 1 deletions

View File

@ -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

View File

@ -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;