Add HTTPCode to APIError #229
Labels
priority: p3
Desirable enhancement or fix. May not be included in next release.
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
APIError was intended to be transport-agnostic, so it currently doesn't have any fields for HTTP or gRPC response codes. However, will lead to some clunky error handling code for users once we use APIError on apiary library calls. To extract the most important fields, users will have to call
errors.As
twice with two separate error types:Code
is in fact the only field fromgoogleapi.Error
that we are currently missing out on inAPIError
. For manual clients such as storage where most users will be HTTP-only, it would be cleaner and easier to document if we could add a method to retrieve this intoAPIError
as well.It may also be nice to pull the gRPC status into APIError as well; however, I think it's preferable to keep these as separate methods (
HTTPCode
andGRPCCode
say) in order to avoid having to map between HTTP and gRPC statuses.The text was updated successfully, but these errors were encountered: