Global error page: ErrorView with per-status copy, did-you-mean suggestions, error ids from handleError, static error.html; 404 instead of 500 for bad progress ids; tolerate full header line in DAISY_TASK_WEBHOOK_HEADER and stop logging raw fetch errors
All checks were successful
Deploy production / deploy (push) Successful in 1m9s
All checks were successful
Deploy production / deploy (push) Successful in 1m9s
This commit is contained in:
10
src/hooks.client.ts
Normal file
10
src/hooks.client.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import type { HandleClientError } from '@sveltejs/kit';
|
||||
|
||||
// Errors thrown while rendering/loading in the browser: same shape as the server (short id,
|
||||
// generic message) so the error page looks the same either way.
|
||||
export const handleError: HandleClientError = ({ error, status, message }) => {
|
||||
if (status === 404) return { message: 'Not Found' };
|
||||
const id = crypto.randomUUID().slice(0, 8);
|
||||
console.error(`[error ${id}] ${status}`, error);
|
||||
return { message: status >= 500 ? 'Internal Error' : message, id };
|
||||
};
|
||||
Reference in New Issue
Block a user