diff --git a/src/hooks.server.ts b/src/hooks.server.ts new file mode 100644 index 0000000..9c75a71 --- /dev/null +++ b/src/hooks.server.ts @@ -0,0 +1,13 @@ +import type { HandleServerError } from '@sveltejs/kit'; +import { randomUUID } from 'crypto'; + +export const handleError: HandleServerError = async ({ error, event, message, status }) => { + const errorId = randomUUID(); + + console.error(error, { errorId, event, message, status }); + + return { + message: 'An Internal Error Occurred', + errorId + }; +};