Hono

Reports Hono errors to Sentry. (default)

Import name: Sentry.honoIntegration

This integration is enabled by default. If you'd like to modify your default integrations, read this.

The honoIntegration automatically captures errors from Hono's onError function and sends them to Sentry. By default, the integration doesn't capture errors that have a 3xx or 4xx HTTP status code.

You can configure the honoIntegration by passing an options object to the function.

This option allows you to provide a function that determines whether an error should be captured, giving you full control over which errors are sent to Sentry.

The function receives the error as an argument and should return true if the error should be reported, and false otherwise.

For example, to report all errors except for 404s, add this to the integrations array when initializing Sentry:

Copied
integrations: [
  honoIntegration({
    shouldHandleError(error) {
      // return true // Would report all errors

      if (error instanceof HTTPException && error.status === 404) {
        // Don't report 404s
        return false;
      }
      // Report all other errors
      return true;
    },
  }),
];
Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").