fix: http user input error#7389
Conversation
Summary of ChangesHello @n1ru4l, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the Fastify error handling mechanism to accurately differentiate between client-side (4XX) and server-side (5XX) errors. Previously, client input errors were being miscategorized and reported as internal server errors in Sentry. The updated handler ensures that only genuine server errors are logged to Sentry, while also providing consistent and appropriate HTTP responses for all error types, irrespective of Sentry's configuration. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors the error handling logic to correctly handle 4xx errors and prevent them from being reported as 500 internal server errors, especially when Sentry is enabled. The changes unify the error handling flow, making it consistent whether Sentry is used or not. The introduction of http-error-handler.ts is a good structural improvement. My main feedback is to ensure the API error responses are consistent in format for both 4xx and 500 status codes.
📚 Storybook DeploymentThe latest changes are available as preview in: https://pr-7389.hive-storybook.pages.dev |
| if (err.statusCode && err.statusCode < 500) { | ||
| req.log.warn(err.message); | ||
| void reply.status(err.statusCode).send(err.message); | ||
| return; |
There was a problem hiding this comment.
Anything with status code below 500 is an user input error and we should not report it.
…pens and we miss it
💻 Website PreviewThe latest changes are available as preview in: https://pr-7389.hive-landing-page.pages.dev |
|
🐋 This PR was built and pushed to the following Docker images: Targets: Platforms: Image Tag: |
Background
An increased amount of security researchers penetrate our API and invalid user input errors where reported as 500 errors on sentry.
Description
Closes https://linear.app/the-guild/issue/CONSOLE-1621/hive-service-fastify-sdk-error-handling
Changes the error handler to