Skip to content

Commit

Permalink
Changes middleware type test to be more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
abalmos committed Oct 17, 2014
1 parent e479956 commit 35e6cd3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion error.js
Expand Up @@ -92,6 +92,13 @@ function OADAError(message, code, userMessage, href, detail) {
writable: true
});

Object.defineProperty(this, 'type', {
configurable: true,
enumerable: false,
value: 'OADAError',
writable: true
});

this.title = this.message;

this.href = href ||
Expand All @@ -113,7 +120,7 @@ module.exports.OADAError = OADAError;

function middleware(cb) {
return function(err, req, res, next) {
if (!(err instanceof OADAError)) {
if(err.type !== 'OADAError') {
return next(err);
}

Expand Down

0 comments on commit 35e6cd3

Please sign in to comment.