Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boom.wrap with a provided message doesn't format the payload #154

Closed
alonl opened this issue May 23, 2017 · 1 comment
Assignees
Milestone

Comments

@alonl
Copy link

@alonl alonl commented May 23, 2017

Boom.wrap with a provided message doesn't format the payload.

Reproduction steps:

> const Boom = require('boom');
> var err = new Error("some error message");
> var boomErr = Boom.wrap(err, 400, "modified error message");

> // actual result:
> boomErr.output.payload
{ statusCode: 400,
  error: 'Bad Request',
  message: 'some error message' }

> boomErr.reformat();
> // expected result:
> boomErr.output.payload
{ statusCode: 400,
  error: 'Bad Request',
  message: 'modified error message: some error message' }

The consequence is that I have to call err.reformat() after every call to Boom.wrap with a provided error message - is this the desired behavior?

BTW, to my observation, the problem is here, where reformat() is called before the message is set.

Many thanks!

@hueniverse hueniverse self-assigned this May 25, 2017
@hueniverse hueniverse added this to the 4.3.2 milestone May 25, 2017
@hueniverse

This comment has been minimized.

Copy link
Member

@hueniverse hueniverse commented May 25, 2017

I am marking this as a breaking change because it will now set a message in the payload when non provided. I would normally release this as a patch but since this is going to change actual API response payloads in some cases, I feel the safe thing to do is a major.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.