Skip to content

Commit

Permalink
Fix route assert. Closes #3909
Browse files Browse the repository at this point in the history
  • Loading branch information
hueniverse committed Jan 18, 2019
1 parent 06a48ea commit 75756f6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/route.js
@@ -1,5 +1,6 @@
'use strict';

const Assert = require('assert');
const Boom = require('boom');
const Bounce = require('bounce');
const Catbox = require('catbox');
Expand Down Expand Up @@ -357,11 +358,17 @@ exports = module.exports = internals.Route = class {
return;
}

if (this.method[0] === '_') {
throw new Error(message);
if (this.method[0] !== '_') {
message = `${message}: ${this.method.toUpperCase()} ${this.path}`;
}

throw new Error(`${message}: ${this.method.toUpperCase()} ${this.path}`);
throw new Assert.AssertionError({
message,
actual: false,
expected: true,
operator: '==',
stackStartFunction: this._assert
});
}
};

Expand Down

0 comments on commit 75756f6

Please sign in to comment.