-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Returning non-200 status from load
in __layout.svelte
causes a Uncaught (in Promise) Error
#4815
Comments
Okay, I've been toying with this and I just want to provide some observations. It appears that the current behavior of non-root . If an error occurs in the
"In the x layout" says to me that the layout has to have finished With that behavior explained, this bug makes a lot of sense. Of course I can think of two solutions:
However, I could also see 1 being a security vulnerability or a "gotcha" for new developers. For example, I check authentication status in |
Thanks for a quick reply 👍 Personally I'm not a fan at all of the error page being rendered inside the main layout. In my world I personally just didn't expect Anyhow, keep up the good work 🥇 |
Since it's now possible to render an error page outside the 'main' layout by moving your routes inside a route group... src/routes/
├ (main)
│ ├ foo/
│ ├ bar/
│ ├ etc/
│ ├ +layout.svelte # can safely throw errors in here
│ └ +page.svelte
├ +error.svelte
└ +layout.svelte # optional ...I'll close this issue |
Describe the bug
Returning a non-
200
status fromload
in__layout.svelte
in a Svelte-Kit app results in an uncaught promise error.It seems to me said function is called recursively when returning a non-
200
status. If you track the number of calls and return200
after the first call toload
everything seems to be fine.Reproduction
https://github.com/poppa/svelte-kit-uncaught-in-promise-sample
Logs
System Info
Severity
serious, but I can work around it
Additional Information
You guys are doing a great job, and Svelte and Svelte-Kit is just awesome.
The text was updated successfully, but these errors were encountered: