Skip to content

Commit

Permalink
Made error message more clear when .customResponse() is used wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
elhigu committed Apr 20, 2017
1 parent c98e606 commit 3f6fd99
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion route/router/Route.js
Expand Up @@ -148,7 +148,7 @@ Route.prototype.handlerMiddleware_ = function (req, res, next) {
return promise.then(function (result) {
if (result === NO_RESULT) {
if (!res.headersSent) {
throw new Error("Handler function did not return promise which won't resolve until response has been sent. " +
throw new Error("When using .customResponse() handler, the promise returned must not resolve before the response has been sent. " +
"Requested path: " + req.path);
}
return;
Expand Down
2 changes: 1 addition & 1 deletion route/tests/Router.spec.js
Expand Up @@ -574,7 +574,7 @@ describe('Router', function () {
});

var nextSpy = spy(function (err) {
expect(err.message).to.contain('Handler function did not return promise');
expect(err.message).to.contain('When using .customResponse() handler, the promise returned must not resolve before');
});

return mockExpressRouter.simulateRequest(request, response, nextSpy)
Expand Down

0 comments on commit 3f6fd99

Please sign in to comment.