moshing-mammut/src/hooks.server.ts

15 lines
405 B
TypeScript
Raw Normal View History

2023-04-02 15:41:33 +00:00
import { TimelineReader } from '$lib/server/timeline';
import type { HandleServerError } from '@sveltejs/kit';
2023-04-02 15:41:33 +00:00
TimelineReader.init();
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;