Files
website/src/hooks.client.ts

11 lines
453 B
TypeScript

import type { HandleClientError } from '@sveltejs/kit';
// Unknown errors thrown while loading/rendering in the browser get an id like on the server, so
// the error page looks the same either way. App and framework errors keep their defaults.
export const handleError: HandleClientError = (input) => {
if (input.kind !== 'unknown') return;
const id = crypto.randomUUID().slice(0, 8);
console.error(`[error ${id}]`, input.error);
return { id };
};