Open oxisto opened 1 year ago
The root +error.svelte
also appears inside the root +layout.svelte
. What happens during SSR if there is an error rendering +error.svelte
or its +layout.svelte
is that it displays a very simple error.html
(https://kit.svelte.dev/docs/project-structure#project-files-src). There could maybe be some sort of similar feature for client-side rendering. I'm not sure what it would look like - but the solution isn't going to be to render +error.svelte
, because we can't display that without its +layout.svelte
.
The root
+error.svelte
also appears inside the root+layout.svelte
. What happens during SSR if there is an error rendering+error.svelte
or its+layout.svelte
is that it displays a very simpleerror.html
(https://kit.svelte.dev/docs/project-structure#project-files-src). There could maybe be some sort of similar feature for client-side rendering. I'm not sure what it would look like - but the solution isn't going to be to render+error.svelte
, because we can't display that without its+layout.svelte
.
Aaah! that makes complete sense. Next to proposing a solution that works similarly like the error.html
, may I suggest to add a caveat warning to the docs (here: https://kit.svelte.dev/docs/errors#expected-errors) that one needs to be careful in throwing expected errors in the root +layout.ts
. It took me a while to figure out why my app was not rendering at all, finally tracing it back to the error in the root layout. Do you want me to prepare a PR for that?
Describe the bug
If SSR is turned off and an error is thrown inside the "root"
+layout.ts
, the whole App does not load. Instead on the console you can see the error message as a rejected promise.The intended behaviour would be to display the contents of the
+error.svelte
page - which seems to work fine if an error is thrown by any other+layout.ts
file in any sub-directory except directly insrc/routes/+layout.ts
Reproduction
Create a
src/routes/+layout.ts
:I prepared a minimal repo as well: https://github.com/oxisto/layout-crash
Logs
System Info
Severity
blocking all usage of SvelteKit
Additional Information
No response