Files
api-worker/apps/worker/src/utils/http.ts
T
2026-02-15 02:12:01 +08:00

15 lines
271 B
TypeScript

import type { Context } from 'hono';
/**
* Sends a JSON error response with a consistent shape.
*/
export function jsonError(c: Context, status: number, message: string, code?: string) {
return c.json(
{
error: message,
code
},
status
);
}