-
Notifications
You must be signed in to change notification settings - Fork 20
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
Feature Request: Client should return all expected status codes #533
Comments
Hey, I agree the error responses are handled poorly right now. The most problematic traits I currently see:
I'll put there random thoughts and let's elaborate. On the server side
On the client side
|
@TylorS @sukovanej have you given any further though to this or scheched something out privately? I'm using effect-http in production and not having typed error on the client side is a noticable downgrade compared api-ts (which we are still using on non-effect based projects). |
I am also interested in graceful handling of errors. If I hate something is libraries that throw in non 2xx scenarios |
At present a
Client
derived from anAPI
loses all type-safety in regards to any non-2xx status codes which are returned directly when making use of theClient
's methods.The way to recover access errors are via
ClientError
. The server-sideClientError
's, which do have a status, are typed asunknown
and must be re-validated manually to ensure type-safety on the client-side by hand.In an ideal world I think these would be strongly typed by default by using the "success" channel of Effect to return all "expected", as defined by your
API
, instead of only 2xx status codes. This allows for type-safe transformation of all "expected" status codes into domain-specific values and/or failures to correspond with these other expected conditions.Prior Discussion: #515
The text was updated successfully, but these errors were encountered: