Documentation ¶
Index ¶
- func Code(err error) codes.Code
- func IsBadRequest(err error) bool
- func IsConflict(err error) bool
- func IsForbidden(err error) bool
- func IsInternalServer(err error) bool
- func IsNotFound(err error) bool
- func IsServiceUnavailable(err error) bool
- func IsUnauthorized(err error) bool
- type ApiError
- func BadRequest(domain, reason, message string) *ApiError
- func Conflict(domain, reason, message string) *ApiError
- func Forbidden(domain, reason, message string) *ApiError
- func FromError(err error) *ApiError
- func InternalServer(domain, reason, message string) *ApiError
- func New(code codes.Code, domain, reason, message string) *ApiError
- func Newf(code codes.Code, domain, reason, format string, a ...interface{}) *ApiError
- func NotFound(domain, reason, message string) *ApiError
- func ServiceUnavailable(domain, reason, message string) *ApiError
- func Unauthorized(domain, reason, message string) *ApiError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsBadRequest ¶
IsBadRequest determines if err is an error which indicates a BadRequest error. It supports wrapped errors.
func IsConflict ¶
IsConflict determines if err is an error which indicates a Conflict error. It supports wrapped errors.
func IsForbidden ¶
IsForbidden determines if err is an error which indicates a Forbidden error. It supports wrapped errors.
func IsInternalServer ¶
IsInternalServer determines if err is an error which indicates an Internal error. It supports wrapped errors.
func IsNotFound ¶
IsNotFound determines if err is an error which indicates an NotFound error. It supports wrapped errors.
func IsServiceUnavailable ¶
IsServiceUnavailable determines if err is an error which indicates a Unavailable error. It supports wrapped errors.
func IsUnauthorized ¶
IsUnauthorized determines if err is an error which indicates a Unauthorized error. It supports wrapped errors.
Types ¶
type ApiError ¶
type ApiError struct { Domain string `json:"domain"` Reason string `json:"reason"` Metadata map[string]string `json:"metadata"` // contains filtered or unexported fields }
func BadRequest ¶
BadRequest new BadRequest error that is mapped to a 400 response.
func InternalServer ¶
InternalServer new InternalServer error that is mapped to a 500 response.
func ServiceUnavailable ¶
ServiceUnavailable new ServiceUnavailable error that is mapped to a HTTP 503 response.
func Unauthorized ¶
Unauthorized new Unauthorized error that is mapped to a 401 response.
func (*ApiError) GRPCStatus ¶
GRPCStatus returns the Status represented by se.