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

Fix 500 errors on 404 routes #135

Merged
merged 2 commits into from
Mar 7, 2022
Merged

Fix 500 errors on 404 routes #135

merged 2 commits into from
Mar 7, 2022

Conversation

dnlup
Copy link
Contributor

@dnlup dnlup commented Mar 7, 2022

🚨 Proposed changes

Please review the guidelines for contributing to this repository.

Perform a check on the presence of the metrics object in request and reply decorators to avoid runtime errors on 404 routes that haven't that object attached to their instance.

Closes #134

⚙️ Types of changes

What types of changes does your code introduce? Put an x in the boxes that apply

  • New feature (non-breaking change which adds functionality)
  • Bugfix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)
  • Refactor

In Reply and Request decorators we need to check for the presence of the `metrics`
object because in 404 errors it is not configured by the `onRoute` hook.
Fixes #134
Copy link
Collaborator

@simonecorsi simonecorsi left a comment

Choose a reason for hiding this comment

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

Great! Lgtm thx 🚀

lib/routes/util.js Outdated Show resolved Hide resolved
@simonecorsi
Copy link
Collaborator

Let me know when you're done because somehow it still say there are changes to be addressed 👍

@simonecorsi simonecorsi merged commit d8bfb27 into next Mar 7, 2022
@simonecorsi
Copy link
Collaborator

🎉 This PR is included in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@simonecorsi simonecorsi deleted the 404_fix branch May 10, 2022 09:38
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