Skip to content

Conversation

s1gr1d
Copy link
Member

@s1gr1d s1gr1d commented Sep 23, 2025

This adds a honoIntegration that exposes a shouldHandleError function that lets users define a custom handling of capturing errors. By default, we capture all Errors and if the error includes a status we capture exceptions with error.status >= 500 || error.status <= 299.

It's possible to modify this behavior like this:

integrations: [
  honoIntegration({
    shouldHandleError: (err) => true; // always capture exceptions in onError
  })
]

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 shouldHandleInOnError or shouldCaptureOnError 🤔 Because it's specifically about the onError function. Let me know what you think.

closes #17717

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@github-actions
Copy link
Contributor

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.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 9,372 - 8,856 +6%
GET With Sentry 1,376 15% 1,366 +1%
GET With Sentry (error only) 6,109 65% 5,990 +2%
POST Baseline 1,187 - 1,201 -1%
POST With Sentry 526 44% 515 +2%
POST With Sentry (error only) 1,071 90% 1,061 +1%
MYSQL Baseline 3,392 - 3,315 +2%
MYSQL With Sentry 404 12% 465 -13%
MYSQL With Sentry (error only) 2,742 81% 2,663 +3%

View base workflow run

import baseConfig from '../../vite/vite.config';

export default defineConfig({
...baseConfig,
Copy link
Member Author

Choose a reason for hiding this comment

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

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.

@s1gr1d s1gr1d force-pushed the sig/hono-integration branch from cf3207d to e910c66 Compare September 24, 2025 07:34
@s1gr1d s1gr1d requested a review from mydea September 24, 2025 07:35
s1gr1d added a commit to getsentry/sentry-docs that referenced this pull request Oct 20, 2025
## 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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

onError handler always captures unhandled error events (adding honoInstrumentation)

2 participants