-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Describe the bug
From the docs: https://svelte.dev/docs/kit/routing#error
+error.svelteis not used when an error occurs insidehandleor a +server.js request handler.
Not sure if this is a bug or feature request, but I'm thinking +error.svelte should be rendered whenever possible, and not only when performing client-side navigation. The current behaviour is inconsistent (see reproduction below).
Reproduction
https://www.sveltelab.dev/g4cglz64hfgy3vm
- Load REPL, observe 500 error rendered by
error.html - Navigate to
/testmanually in the preview pane - Click on 'home' link
- Observer
/src/routes/+error.sveltebeing rendered instead oferror.html
System Info
System:
OS: Linux 5.0 undefined
CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 18.20.3 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.2.3 - /usr/local/bin/npm
pnpm: 8.15.6 - /usr/local/bin/pnpm
npmPackages:
@sveltejs/adapter-auto: ^3.0.0 => 3.3.1
@sveltejs/kit: ^2.5.27 => 2.20.2
@sveltejs/vite-plugin-svelte: ^5.0.0 => 5.0.3
svelte: ^5 => 5.25.3
vite: ^6.0.0 => 6.2.3Severity
annoyance
Additional Information
I could not find duplicate issues, and I'm not sure if this is a bug or feature request. If implemented, it would certainly be a breaking change and a potential candidate for SvelteKit 3.
Here's a somewhat related problem presented on Discord: Documentation/help for custom error page for top-level hooks.server.ts error in which someone is attempting to use reroute to maintain the URL while capturing and throwing errors in handle.