handleError for Server Error Logging
Catch unexpected server errors and send them to your logging or monitoring service.
Catching Errors
Unexpected errors in load or endpoints can be observed via handleError.
Export handleError
Export from hooks.server.js.
export async function handleError({ error, event }) {
console.error(error);
return { message: "Something went wrong" };
}All lessons in this course
- The handle() Hook: Middleware for Requests
- handleError for Server Error Logging
- The init() Hook
- Sequence() for Composing Hooks