handle server side errors
This commit is contained in:
parent
aa968fd61e
commit
817c3a78ac
1 changed files with 13 additions and 0 deletions
13
src/hooks.server.ts
Normal file
13
src/hooks.server.ts
Normal file
|
|
@ -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
|
||||||
|
};
|
||||||
|
};
|
||||||
Loading…
Add table
Add a link
Reference in a new issue