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 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.

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 s1gr1d merged commit 34538c8 into develop Sep 24, 2025
48 checks passed
@s1gr1d s1gr1d deleted the sig/hono-integration branch September 24, 2025 14:18
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