12 lines
326 B
TypeScript
12 lines
326 B
TypeScript
|
import type { HandleServerError } from '@sveltejs/kit';
|
||
|
|
||
|
export const handleError = (({ error }) => {
|
||
|
if (error instanceof Error) {
|
||
|
console.error('Something went wrong: ', error.name, error.message);
|
||
|
}
|
||
|
|
||
|
return {
|
||
|
message: 'Whoops!',
|
||
|
code: (error as any)?.code ?? 'UNKNOWN'
|
||
|
};
|
||
|
}) satisfies HandleServerError;
|