refactor: improve error handling in server hooks and update meta tags for social sharing

This commit is contained in:
2026-03-01 04:09:55 +01:00
parent d74092231e
commit e0c021782c
6 changed files with 11 additions and 11 deletions

View File

@@ -76,12 +76,12 @@ export const handle: Handle = handleBetterAuth;
// Catches unhandled errors from load functions, API routes, etc.
// Logs context for debugging; returns a safe message to the client.
export const handleError: HandleServerError = ({ error, event }) => {
const err = error as any;
const err = error instanceof Error ? error : new Error(String(error));
console.error('[Server Error]', {
message: err?.message ?? String(error),
message: err.message,
path: event.url.pathname,
method: event.request.method,
stack: err?.stack
stack: err.stack
});
return { message: 'An unexpected error occurred.' };
};