-
Notifications
You must be signed in to change notification settings - Fork 149
Open
Labels
area/generatorAffects: plugin, CLI, config file.Affects: plugin, CLI, config file.area/runtimeAffects: the runtime library.Affects: the runtime library.kind/enhancementImprovements to existing feature.Improvements to existing feature.
Description
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 {
_ = try await try await client.getGreeting(input: ...)
} catch as 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 {
_ = try await try await client.getGreeting(input: ...)
} catch {
// This branch is always taken and error is statically known to be ClientError
}edorphy
Metadata
Metadata
Assignees
Labels
area/generatorAffects: plugin, CLI, config file.Affects: plugin, CLI, config file.area/runtimeAffects: the runtime library.Affects: the runtime library.kind/enhancementImprovements to existing feature.Improvements to existing feature.