Expected vs Unexpected Errors
Distinguish user-facing expected errors from unexpected server errors.
Two Categories
SvelteKit distinguishes expected errors (thrown intentionally) from unexpected errors (bugs).
Expected: error()
Call error(status, message) for known failure cases.
if (!post) error(404, "Post not found");All lessons in this course
- +error.svelte for Custom Error Pages
- Expected vs Unexpected Errors
- error() and redirect() Helpers
- Error Pages in Nested Layouts