Skip to content

Conversation

s1gr1d
Copy link
Member

@s1gr1d s1gr1d commented May 21, 2025

Our cloudflare SDK captures fetch exceptions in the catch block. But hono never reaches this block where we send exceptions.
hono processes errors with their onError function (or errorHandler) and we need to capture the exception there.

This PR wraps the errorHandler of hono.

Will create an E2E test in another PR.

@s1gr1d s1gr1d changed the title Sig/hono error handler fix(cloudflare): Capture exceptions thrown in hono May 21, 2025
if (
'onError' in handler &&
'errorHandler' in handler &&
typeof handler.errorHandler === 'function' &&
Copy link
Member

Choose a reason for hiding this comment

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

So this is always defined right? We don't need to create one for a user if it's not defined?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Nice!

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.

3 participants