mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
feat: add onError() function hono handler
This commit is contained in:
parent
a7f2fb06ee
commit
e6c38550c6
1 changed files with 7 additions and 0 deletions
|
|
@ -340,6 +340,13 @@ app.get('/', frontendController, indexController);
|
||||||
// Fallback
|
// Fallback
|
||||||
app.get('*', publicFiles, staticFiles, frontendController);
|
app.get('*', publicFiles, staticFiles, frontendController);
|
||||||
|
|
||||||
|
app.onError((err, c) => {
|
||||||
|
if (err.message === 'canceling statement due to statement timeout') {
|
||||||
|
return c.json({ error: 'Everything will be fine, I mean it. Don\t worry child.' }, 500);
|
||||||
|
}
|
||||||
|
return c.json(500);
|
||||||
|
});
|
||||||
|
|
||||||
export default app;
|
export default app;
|
||||||
|
|
||||||
export type { AppContext, AppController, AppMiddleware };
|
export type { AppContext, AppController, AppMiddleware };
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue