Skip to content

Commit

Permalink
chore(web): handle error
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Sep 11, 2024
1 parent d58e427 commit db1e1a8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apps/frontend/web/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,14 @@ const app = new Hono<ContextEnv>();

app.use('*', staticAssets(), remix({ build: build as any }));

app.onError((err, c) => {
if (err.message) {
console.log(...err.message.trim().split('\n'));
}
if (err.stack) {
console.log(...err.stack.trim().split('\n'));
}
return c.json({ status: 500, messsage: err?.message ?? 'Internal Error' }, 500);
});

export default app;

0 comments on commit db1e1a8

Please sign in to comment.