mirror of
https://github.com/feathersjs/feathers.git
synced 2026-01-25 15:23:13 +00:00
Merge pull request #28 from feathersjs/explicit-error-type
adding an explicit error type
This commit is contained in:
parent
e2960c41cc
commit
c753a3ee89
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user