Open alexgleason opened 2 months ago
We are trying to work around this by catching the error, but it's actually an instance of Error
and not HTTPException
, so neither of these solutions work:
app.use('*', sentryMiddleware({ dsn: Conf.sentryDsn, ignoreErrors: 'HTTPException' }));
app.onError((err) => {
if (err instanceof HTTPException) {
return err.getResponse();
}
throw err;
});
It's just a plain Error
:
@sam-lippert Can you see it?
Also have this issue. I'm doing something like this
app.use(
'*',
sentry({
ignoreErrors: ['Unauthorized']
})
)
and throwing the error like so:
const user = c.get('user')
if (!user) {
throw new HTTPException(401, { message: 'Unauthorized' })
}
But for some reason the error is still being sent to Sentry.
Hello! We are throwing an HTTPException in our code. hono/sentry captures this and creates an event in Sentry:
Is this the expected behavior? To me it seems that HTTPException shouldn't be captured, since it's actually a "handled" exception, in the sense that we are returning it manually (as an "escape-hatch") because we expect it to occur.