error() and redirect() Helpers
Throw typed errors and redirects from load functions and actions.
Two Built-In Helpers
error() and redirect() from @sveltejs/kit handle the two main user-facing branches.
error Helper
Throws a structured error with status and message.
import { error } from "@sveltejs/kit";
error(404, "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