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

leveraged the error formatter when data is an Error #86

Merged
merged 1 commit into from Feb 8, 2017

Conversation

@travi
Copy link
Contributor

travi commented Feb 3, 2017

for events that are not handled specifically by eventName, the error formatter is used to provide more useful information when the event data is an Error

this is my solution to #84 for local logging. while you suggested my own transform, this seemed like a simple enough change that it might make sense to include. if i could convince you that it aligns with the goals of the project, i would love to not have the need to maintain my own fork in order to have this visibility into errors.

i'm happy to make adjustments if there are things that would make it better align with the project

@@ -125,6 +125,12 @@ internals.utility = {

formatDefault(event, tags, settings) {

if (event.data instanceof Error) {

This comment has been minimized.

Copy link
@arb

arb Feb 5, 2017

Contributor

Is this something that can actually happen when using hapi?

This comment has been minimized.

Copy link
@arb

arb Feb 5, 2017

Contributor

Also, move this into the _transform function instead. It's weird to do formatDefault and then branch to formatError

This comment has been minimized.

Copy link
@travi

travi Feb 5, 2017

Author Contributor

The case where i run into it is when passing an error to request.log

This comment has been minimized.

Copy link
@travi

travi Feb 5, 2017

Author Contributor

moving to _transform is totally reasonable to me. i debated a couple different places for it to go, so this works. i agree that it is probably better in line with the rest of the conditionals.

updated

@@ -125,6 +125,12 @@ internals.utility = {

formatDefault(event, tags, settings) {

if (event.data instanceof Error) {

This comment has been minimized.

Copy link
@arb

arb Feb 5, 2017

Contributor

Also, move this into the _transform function instead. It's weird to do formatDefault and then branch to formatError

for events that are not handled specifically by eventName, the error formatter is used to provide more useful information when the event data is an Error
@travi travi force-pushed the travi:error-as-data branch from adef550 to 48b4e04 Feb 5, 2017
@arb arb self-assigned this Feb 5, 2017
@arb arb modified the milestone: 6.4.0 Feb 5, 2017
@arb arb added the feature label Feb 5, 2017
@arb
arb approved these changes Feb 8, 2017
@arb arb merged commit e32cec6 into hapijs:master Feb 8, 2017
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@travi travi deleted the travi:error-as-data branch Feb 8, 2017
@travi

This comment has been minimized.

Copy link
Contributor Author

travi commented Feb 8, 2017

thanks!

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.