-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Describe the bug
As described in the SvelteKit docs here https://kit.svelte.dev/docs/errors#responses certain errors are supposed to redirect to src/error.html
instead of +error.svelte
. I tested this by adding the following code to the script
tag of my root +layout.svelte
file which has a +page.ts
file adjacent to it containing export const ssr = false;
.
throw error(404, { message: 'test' })
I would expect an error in the root of my app to use the built-in SvelteKit error handling and either send me to error.html
or error.svelte
. But neither of these actions happen. Instead it renders a blank page showing nothing at all to the user (not even a default error page). And this is printed in the browser console:
[HMR][Svelte] Unrecoverable HMR error in <+layout>: next update will trigger a full reload
I tested the same page but without the ssr = false
and it falls back to the error.html
page which I think is what is supposed to happen.
Client side rendered pages should still be able to have error fall backs right?
I also tested throwing an error inside a component that is rendered on the root page and it also shows no error state, instead the component is just not rendered at all and there is a blank spot on the page where the component would have loaded. I think this behaviour is not expected?
Thanks
Reproduction
https://github.com/secondl1ght/sveltekit-error-demo
Logs
No response
System Info
System:
OS: Linux 5.15 Zorin OS 16.2
CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
Memory: 7.85 GB / 31.19 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 16.15.1 - ~/.nvm/versions/node/v16.15.1/bin/node
Yarn: 1.22.19 - /usr/bin/yarn
npm: 8.11.0 - ~/.nvm/versions/node/v16.15.1/bin/npm
Browsers:
Brave Browser: 114.1.52.130
npmPackages:
@sveltejs/adapter-auto: ^2.0.0 => 2.1.0
@sveltejs/kit: ^1.20.4 => 1.22.3
svelte: ^4.0.5 => 4.0.5
vite: ^4.4.2 => 4.4.3
Severity
serious, but I can work around it
Additional Information
No response