Documentation ¶
Index ¶
- func ErrorAsGRPCStatus(err error) *grpcStatus.Status
- func LogAndSetHTTPError(ctx context.Context, w http.ResponseWriter, log log.Logger, err error)
- func WithErrorxTypeDetail(s *grpcStatus.Status, details ...protov1.Message) *grpcStatus.Status
- type BadRequest
- type Conflict
- type Disabled
- type Error
- type Internal
- type RateLimited
- type RequiresProxyRequest
- func (e RequiresProxyRequest) Error() string
- func (e RequiresProxyRequest) GRPCStatus() *grpcStatus.Status
- func (e RequiresProxyRequest) GRPCStatusDetails() []protov1.Message
- func (e RequiresProxyRequest) HTTPStatusCode() int
- func (e RequiresProxyRequest) Message() string
- func (e RequiresProxyRequest) Unwrap() error
- type TooManyRequests
- type Unimplemented
- type UnprocessableEntity
- type UnsupportedMediaType
- func (e UnsupportedMediaType) Error() string
- func (e UnsupportedMediaType) GRPCStatus() *grpcStatus.Status
- func (e UnsupportedMediaType) GRPCStatusDetails() []protov1.Message
- func (e UnsupportedMediaType) HTTPStatusCode() int
- func (e UnsupportedMediaType) Message() string
- func (e UnsupportedMediaType) Unwrap() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorAsGRPCStatus ¶
func ErrorAsGRPCStatus(err error) *grpcStatus.Status
ErrorAsGRPCStatus generates a new Status from the given generic error. If there is a GRPCStatus-compatible error wrapped inside, that type and details are used to generate the new status. If there is a problem encoding the details, an Internal error is thrown. The message is retrieved from the outermost error. Non-errorx errors are given the Unknown error type.
func LogAndSetHTTPError ¶
LogAndSetHTTPError logs the provided error and then translates the internal error into a http response. The error message set in the response is conservative in an attempt to prevent internal details (e.g. GCS bucket name) from leaking. If the error is from this errorx package, the top-level message is logged. Otherwise, hardcoded messages are returned
func WithErrorxTypeDetail ¶
func WithErrorxTypeDetail(s *grpcStatus.Status, details ...protov1.Message) *grpcStatus.Status
Types ¶
type BadRequest ¶
func (BadRequest) Error ¶
func (e BadRequest) Error() string
func (BadRequest) GRPCStatus ¶
func (e BadRequest) GRPCStatus() *grpcStatus.Status
func (BadRequest) GRPCStatusDetails ¶
func (e BadRequest) GRPCStatusDetails() []protov1.Message
func (BadRequest) HTTPStatusCode ¶
func (e BadRequest) HTTPStatusCode() int
func (BadRequest) Message ¶
func (e BadRequest) Message() string
func (BadRequest) Unwrap ¶
func (e BadRequest) Unwrap() error
type Conflict ¶
func (Conflict) GRPCStatus ¶
func (e Conflict) GRPCStatus() *grpcStatus.Status
func (Conflict) GRPCStatusDetails ¶
func (Conflict) HTTPStatusCode ¶
type Disabled ¶
type Disabled struct{}
func (Disabled) GRPCStatus ¶
func (e Disabled) GRPCStatus() *grpcStatus.Status
func (Disabled) GRPCStatusDetails ¶
func (Disabled) HTTPStatusCode ¶
type Error ¶
type Error interface { error HTTPStatusCode() int Message() string GRPCStatus() *grpcStatus.Status GRPCStatusDetails() []protov1.Message }
func FromGRPCStatus ¶
func FromGRPCStatus(s *grpcStatus.Status) Error
FromGRPCStatus converts a Status to a native Error type. The GRPC Status type is ignored in this conversion -- instead we expect ErrorDetails to be included naming the correct internal type. Statuses without details will be returned as Internal errors.
type Internal ¶
func (Internal) GRPCStatus ¶
func (e Internal) GRPCStatus() *grpcStatus.Status
func (Internal) GRPCStatusDetails ¶
func (Internal) HTTPStatusCode ¶
type RateLimited ¶
func (RateLimited) Error ¶
func (e RateLimited) Error() string
func (RateLimited) GRPCStatus ¶
func (e RateLimited) GRPCStatus() *grpcStatus.Status
func (RateLimited) GRPCStatusDetails ¶
func (e RateLimited) GRPCStatusDetails() []protov1.Message
func (RateLimited) HTTPStatusCode ¶
func (e RateLimited) HTTPStatusCode() int
func (RateLimited) Message ¶
func (e RateLimited) Message() string
func (RateLimited) Unwrap ¶
func (e RateLimited) Unwrap() error
type RequiresProxyRequest ¶
type RequiresProxyRequest struct { Msg string Err error // Reason field should be a low cardinality value, used for labeling metrics. Reason string }
RequiresProxyRequest signifies the request could not be completed locally (eg. unsupported target function), so should be forwarded to the appropriate proxy.
func (RequiresProxyRequest) Error ¶
func (e RequiresProxyRequest) Error() string
func (RequiresProxyRequest) GRPCStatus ¶
func (e RequiresProxyRequest) GRPCStatus() *grpcStatus.Status
func (RequiresProxyRequest) GRPCStatusDetails ¶
func (e RequiresProxyRequest) GRPCStatusDetails() []protov1.Message
func (RequiresProxyRequest) HTTPStatusCode ¶
func (e RequiresProxyRequest) HTTPStatusCode() int
func (RequiresProxyRequest) Message ¶
func (e RequiresProxyRequest) Message() string
func (RequiresProxyRequest) Unwrap ¶
func (e RequiresProxyRequest) Unwrap() error
type TooManyRequests ¶
func (TooManyRequests) Error ¶
func (e TooManyRequests) Error() string
func (TooManyRequests) GRPCStatus ¶
func (e TooManyRequests) GRPCStatus() *grpcStatus.Status
func (TooManyRequests) GRPCStatusDetails ¶
func (e TooManyRequests) GRPCStatusDetails() []protov1.Message
func (TooManyRequests) HTTPStatusCode ¶
func (e TooManyRequests) HTTPStatusCode() int
func (TooManyRequests) Message ¶
func (e TooManyRequests) Message() string
func (TooManyRequests) Unwrap ¶
func (e TooManyRequests) Unwrap() error
type Unimplemented ¶
type Unimplemented struct {
Msg string
}
func (Unimplemented) Error ¶
func (e Unimplemented) Error() string
func (Unimplemented) GRPCStatus ¶
func (e Unimplemented) GRPCStatus() *grpcStatus.Status
func (Unimplemented) GRPCStatusDetails ¶
func (e Unimplemented) GRPCStatusDetails() []protov1.Message
func (Unimplemented) HTTPStatusCode ¶
func (e Unimplemented) HTTPStatusCode() int
func (Unimplemented) Message ¶
func (e Unimplemented) Message() string
type UnprocessableEntity ¶
type UnprocessableEntity struct {
Msg string
}
func (UnprocessableEntity) Error ¶
func (e UnprocessableEntity) Error() string
func (UnprocessableEntity) GRPCStatus ¶
func (e UnprocessableEntity) GRPCStatus() *grpcStatus.Status
func (UnprocessableEntity) GRPCStatusDetails ¶
func (e UnprocessableEntity) GRPCStatusDetails() []protov1.Message
func (UnprocessableEntity) HTTPStatusCode ¶
func (e UnprocessableEntity) HTTPStatusCode() int
func (UnprocessableEntity) Message ¶
func (e UnprocessableEntity) Message() string
type UnsupportedMediaType ¶
func (UnsupportedMediaType) Error ¶
func (e UnsupportedMediaType) Error() string
func (UnsupportedMediaType) GRPCStatus ¶
func (e UnsupportedMediaType) GRPCStatus() *grpcStatus.Status
func (UnsupportedMediaType) GRPCStatusDetails ¶
func (e UnsupportedMediaType) GRPCStatusDetails() []protov1.Message
func (UnsupportedMediaType) HTTPStatusCode ¶
func (e UnsupportedMediaType) HTTPStatusCode() int
func (UnsupportedMediaType) Message ¶
func (e UnsupportedMediaType) Message() string
func (UnsupportedMediaType) Unwrap ¶
func (e UnsupportedMediaType) Unwrap() error