mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-31 02:54:21 +01:00
Move errorHandler to a separate file
This commit is contained in:
11
src/controllers/error.ts
Normal file
11
src/controllers/error.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { ErrorHandler } from '@hono/hono';
|
||||
|
||||
export const errorHandler: ErrorHandler = (err, c) => {
|
||||
console.error(err);
|
||||
|
||||
if (err.message === 'canceling statement due to statement timeout') {
|
||||
return c.json({ error: 'The server was unable to respond in a timely manner' }, 500);
|
||||
}
|
||||
|
||||
return c.json({ error: 'Something went wrong' }, 500);
|
||||
};
|
||||
Reference in New Issue
Block a user