You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! I juste wanted to ask if it's possible to get the error types to properly handle error cases when making a request. Basically, I'm making a PUT and the request and response body are perfectly typed, but this is not the case of the error(s). Basically, the error is a union type of all possible and declared "wrong cases" (4**).
I wanted something more like switching on error statuses, and get typed-error messages, narrowed by these statuses.
Would it be "dangerous" to assume those types are safe, or is it better to try each possibility of the error union type, then have a fallback where only raw statusCode and text can help ?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello! I juste wanted to ask if it's possible to get the error types to properly handle error cases when making a request. Basically, I'm making a PUT and the request and response body are perfectly typed, but this is not the case of the error(s). Basically, the error is a union type of all possible and declared "wrong cases" (4**).
I wanted something more like switching on error statuses, and get typed-error messages, narrowed by these statuses.
Would it be "dangerous" to assume those types are safe, or is it better to try each possibility of the error union type, then have a fallback where only raw statusCode and text can help ?
Beta Was this translation helpful? Give feedback.
All reactions