import { Context } from 'hono' import { HTTPException } from 'hono/http-exception' export const errorHandler = async (err: Error, c: Context) => { if (err instanceof HTTPException) { return c.json( { error: err.message, status: err.status , cause: err.cause }, err.status ) } return c.json( { error: 'Internal Server Error', status: 500 }, 500 ) }