Overview - Error pages (+error.svelte)
What is it?
Error pages in SvelteKit are special components that show up when something goes wrong during navigation or data loading. The +error.svelte file is a dedicated component that handles these errors gracefully by displaying helpful messages to users. It replaces default browser error messages with custom, user-friendly content. This helps keep your app looking polished even when unexpected problems occur.
Why it matters
Without error pages, users see confusing or ugly browser error messages that break the experience. Custom error pages let you explain what happened, guide users on what to do next, and keep your app professional. They prevent frustration and help maintain trust, especially when network issues or bugs happen. This improves overall user satisfaction and reduces support requests.
Where it fits
Before learning error pages, you should understand basic SvelteKit routing and how components work. After mastering error pages, you can explore advanced error handling like server-side error responses, fallback UI, and integrating error logging services. Error pages fit into the broader topic of building resilient, user-friendly web apps.