Replies: 2 comments
-
I'm sorry, but where did you take that information from? I can't find it anywhere. |
Beta Was this translation helpful? Give feedback.
0 replies
-
This: https://kit.svelte.dev/docs/routing#error page mentions it briefly:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a page with the paths
[slug]/+page.svelte
and[slug]/+page.server.ts
. I also have a+error.svelte
error page. Inside the+page.server.ts
I'm fetching the page contents from a CMS. If the slug does not exist inside the CMS, I want to trigger a 404 page witherror(404, "Not found")
. But for some reason, the error call gets ignored completely.Now, I've read that
error()
does not seem to be supported in*.server.ts
files (which is only mentioned as a little disclaimer here: https://kit.svelte.dev/docs/load#errors and not at all here: https://kit.svelte.dev/docs/errors). What would be the best approach here?(Note: I don't want to import
tryFetchPageFromCMS
into client code as I don't want to compile and leak CMS authentication details to the client.)My
+page.server.ts
for reference:Beta Was this translation helpful? Give feedback.
All reactions