Skip to content

fix: Move axios error processing in LoggerService#122

Merged
dipasqualew merged 3 commits intomasterfrom
move-axios-logic-to-logger
Dec 15, 2020
Merged

fix: Move axios error processing in LoggerService#122
dipasqualew merged 3 commits intomasterfrom
move-axios-logic-to-logger

Conversation

@dipasqualew
Copy link
Copy Markdown
Contributor

Services might catch the error and just log it, so it would not be
propagated at top level and pretty-printed. Extending LoggerService
takes care of those use cases.

Services might catch the error and just log it, so it would not be
propagated at top level and pretty-printed. Extending LoggerService
takes care of those use cases.
@dipasqualew dipasqualew self-assigned this Dec 14, 2020
}

this.logger.log('error', message, { error });
this.logger.log('error', message, { error: this.processMessage(error) });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the naming is a bit confusing. We have a method that takes error and message, but its error that we pass to another method called processMessage

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. How would you name the method?

Copy link
Copy Markdown
Contributor

@tomisaacmarshall tomisaacmarshall Dec 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤣 erm .... well ... maybe just have a processError method. And check it's an error first.

Like, would we ever want to process a string really?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need the same functionality for logger.info as it is reasonable a function might call it with an axios error (I know this happens in a couple of places)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, am aware of that ... was envisaging the check would happen there as well.

Copy link
Copy Markdown
Contributor

@tomisaacmarshall tomisaacmarshall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving as the naming point is just a suggestion really.

@dipasqualew dipasqualew merged commit cc8fe85 into master Dec 15, 2020
@dipasqualew dipasqualew deleted the move-axios-logic-to-logger branch December 15, 2020 08:24
@lebaz20
Copy link
Copy Markdown
Contributor

lebaz20 commented Dec 15, 2020

🎉 This PR is included in version 1.2.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants