Throwing Unchecked Errors in Sveltekit's Page.Server.ts Load Function
How can I throw an unchecked error from within an effect? I'm trying to do a basic flow within Sveltekit's page.server.ts load function.
Their mechanism for handling 404s is to throw what is essentially a "redirect object". I'm trying to do the same thing, but I'm not sure how to throw an error from within an effect.
I'm missing some piece of the puzzle surrounding how to manage defects.
Ideally, this redirect is "expected" behavior when the user doesn't exist, so I'd like to keep it in the effect, and handle as a caught tag.
I get a pretty unhelpful error message in the vite logs related to
If I surrouned the Effect.runPromise with a try/catch, I can see the following
Their mechanism for handling 404s is to throw what is essentially a "redirect object". I'm trying to do the same thing, but I'm not sure how to throw an error from within an effect.
I'm missing some piece of the puzzle surrounding how to manage defects.
Ideally, this redirect is "expected" behavior when the user doesn't exist, so I'd like to keep it in the effect, and handle as a caught tag.
works (default way of doing the 404 redirect)
doesnt work
I get a pretty unhelpful error message in the vite logs related to
TypeError: Cannot read properties of undefined (reading 'trim') when attempting the Effect version on failure.If I surrouned the Effect.runPromise with a try/catch, I can see the following
