From 75756f6abdd3bc67d8a95130e9857fcde0bcb4df Mon Sep 17 00:00:00 2001 From: Eran Hammer Date: Fri, 18 Jan 2019 12:17:49 -0800 Subject: [PATCH] Fix route assert. Closes #3909 --- lib/route.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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 + }); } };