Post

Well for one it doesn't mess with the types. So you can return some data from the server function and if you want to, throw the user to login but the types will only show the data your returning.

I understand I "can" do lots of things within a specific API design. But redirect seems a really normal result. Throwing is commonly used for abnormal interruption. Not to mention that SE in general is slightly moving away from exceptions, mostly, due to overhead due to building stack traces.

I mean redirects are as normal as throwing errors. I don't see the problem with not returning them. I have very rarely had an endpoint that would redirect, but your mileage may vary. And I don't think you're going to feel the perf impact of throwing instead of returning 😅

Yup. Although it "can" work, I struggle to see advantages as compared to a "standard" approach.

0 reposts1 like

No replies yet.