diff --git a/lib/route.js b/lib/route.js index fae3f1f8f..aee908800 100755 --- a/lib/route.js +++ b/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'); @@ -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 + }); } };