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
{{ message }}
Repository navigation
Consider using typed throws on methods that always throw ClientError/ServerError #844
Consider using typed throws on methods that always throw ClientError/ServerError.
This will allow adopters to remove an extra } catch { that doesn't have clear purpose.
do{_=tryawaittryawaitclient.getGreeting(input:...)}catchas ClientError {
// This branch is always taken
}catch{
// This branch is never taken, we always throw ClientError
}
Similar on the server.
With typed throws, we'll be able to do:
do{_=tryawaittryawaitclient.getGreeting(input:...)}catch{
// This branch is always taken and error is statically known to be ClientError
}
Reacted by Eric Dorphy, Marko Opačić and Ferenc Viasz-Kadi
If we're gonna investigate having user handlers be typed throws we might consider enforcing that any error thrown out of the handler is convertible to HTTP status. We discussed this as an alternative direction when discussing the error handling middleware.
Activity
simonjbeaumont commentedon Nov 8, 2025
If we're gonna investigate having user handlers be typed throws we might consider enforcing that any error thrown out of the handler is convertible to HTTP status. We discussed this as an alternative direction when discussing the error handling middleware.