Refactor how youtube videos are handled, log errors via hook

This commit is contained in:
2023-04-02 17:37:55 +02:00
parent 2d5df49aa9
commit f6ae387e49
3 changed files with 44 additions and 28 deletions

12
src/hooks.server.ts Normal file
View File

@ -0,0 +1,12 @@
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;