Skip to content
Discussion options

You must be logged in to vote

This is expected, and it's documented: SvelteKit renders errors differently depending on where they're thrown, not on the status code.

Why they look different

  • A request to a route that doesn't exist, or any error you throw with error(...) directly inside handle in hooks.server.ts (or inside a +server.js handler), gets the fallback error page (src/error.html, or SvelteKit's built-in default if you haven't added one). This never touches your +error.svelte component tree.
  • An error thrown inside a load function (page or layout) bubbles up to the nearest +error.svelte above it in the route tree, same as a normal SvelteKit "framework" 404 for an unmatched route (that one also renders via the r…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by hvisser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants