-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(cloudflare): Capture exceptions thrown in hono #16355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
if ( | ||
'onError' in handler && | ||
'errorHandler' in handler && | ||
typeof handler.errorHandler === 'function' && |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, hono has a default error handler: https://github.com/honojs/hono/blob/bb7afaccfd5b6b514da356e069f27eb5ccfc0e3b/src/hono-base.ts#L36
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
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 (orerrorHandler
) and we need to capture the exception there.This PR wraps the
errorHandler
of hono.Will create an E2E test in another PR.