Uh oh!
There was an error while loading. Please reload this page.
feat(cloudflare): Add honoIntegration with error-filtering function - #17743
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
node-overhead report 🧳Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
|
| import baseConfig from '../../vite/vite.config'; | ||
| export default defineConfig({ | ||
| ...baseConfig, |
There was a problem hiding this comment.
I needed to add a vite.config.ts file because the baseConfig defines this:
define: {
__DEBUG_BUILD__: true,
},
...and this was needed to make the unit tests work.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
cf3207d to
e910c66CompareUh oh!
There was an error while loading. Please reload this page.
## DESCRIBE YOUR PR This adds docs for this PR: getsentry/sentry-javascript#17743 ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [ ] None: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it. Thanks in advance for your help! ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) --------- Co-authored-by: Sarah Mischinger <sarah@codingwriter.com>
Adds the error filtering logic to the Hono `sentry()` middleware. It already exists in the to-be deprecated `honoIntegration`: #17743 `isExpectedError` was renamed to `defaultShouldHandleError` so the name is matching with the user-provided parameter. I also removed the special catching **within** the middleware, as it's just "duplicated code". The error bubbles through the Hono context anyway - it's a bit simpler now. Closes#21204
This adds a
honoIntegrationthat exposes ashouldHandleErrorfunction that lets users define a custom handling of capturing errors. By default, we capture allErrors and if the error includes astatuswe capture exceptions witherror.status >= 500 || error.status <= 299.It's possible to modify this behavior like this:
Up for discussion: The function name is the same like in express/fastify to keep it consistent. But I was also thinking about other names like
shouldHandleInOnErrororshouldCaptureOnError🤔 Because it's specifically about theonErrorfunction. Let me know what you think.closes#17717