Documentation ¶
Overview ¶
Package apierror implements a wrapper error for parsing error details from API calls. Both HTTP & gRPC status errors are supported.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
// contains filtered or unexported fields
}
APIError wraps either a gRPC Status error or a HTTP googleapi.Error. It implements error and Status interfaces.
func (*APIError) Details ¶
func (a *APIError) Details() ErrDetails
Details presents the error details of the APIError.
func (*APIError) Domain ¶
Domain returns the domain in an ErrorInfo. If ErrorInfo is nil, it returns an empty string.
func (*APIError) GRPCStatus ¶
GRPCStatus extracts the underlying gRPC Status error. This method is necessary to fulfill the interface described in https://pkg.go.dev/google.golang.org/grpc/status#FromError.
func (*APIError) Metadata ¶
Metadata returns the metadata in an ErrorInfo. If ErrorInfo is nil, it returns nil.
type ErrDetails ¶
type ErrDetails struct { ErrorInfo *errdetails.ErrorInfo BadRequest *errdetails.BadRequest PreconditionFailure *errdetails.PreconditionFailure QuotaFailure *errdetails.QuotaFailure RetryInfo *errdetails.RetryInfo ResourceInfo *errdetails.ResourceInfo RequestInfo *errdetails.RequestInfo DebugInfo *errdetails.DebugInfo Help *errdetails.Help LocalizedMessage *errdetails.LocalizedMessage // Unknown stores unidentifiable error details. Unknown []interface{} }
ErrDetails holds the google/rpc/error_details.proto messages.
func (ErrDetails) String ¶
func (e ErrDetails) String() string