Documentation ¶
Index ¶
- Variables
- func ServeJSON(w http.ResponseWriter, err error) error
- type Error
- type ErrorCode
- func (ec ErrorCode) Descriptor() ErrorDescriptor
- func (ec ErrorCode) Error() string
- func (ec ErrorCode) ErrorCode() ErrorCode
- func (ec ErrorCode) MarshalText() ([]byte, error)
- func (ec ErrorCode) Message() string
- func (ec ErrorCode) String() string
- func (ec *ErrorCode) UnmarshalText(text []byte) error
- func (ec ErrorCode) WithArgs(args ...interface{}) Error
- func (ec ErrorCode) WithDetail(detail interface{}) Error
- func (ec ErrorCode) WithMessage(message string) Error
- type ErrorCoder
- type ErrorDescriptor
- type Errors
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrorCodeUnknown = Register("errcode", ErrorDescriptor{ Value: "UNKNOWN", Message: "unknown error", Description: "Generic error returned when the error does not have a classification.", HTTPStatusCode: http.StatusInternalServerError, }) ErrorCodeUnsupported = Register("errcode", ErrorDescriptor{ Value: "UNSUPPORTED", Message: "the operation is unsupported", Description: "The operation was unsupported due to invalid parameters or missing implementation.", HTTPStatusCode: http.StatusMethodNotAllowed, }) )
Functions ¶
Types ¶
type Error ¶
type Error struct { Code ErrorCode `json:"code"` Message string `json:"message"` Detail interface{} `json:"detail,omitempty"` }
func (Error) WithDetail ¶
type ErrorCode ¶
type ErrorCode int
func Register ¶
func Register(group string, descriptor ErrorDescriptor) ErrorCode
func (ErrorCode) Descriptor ¶
func (ec ErrorCode) Descriptor() ErrorDescriptor
func (ErrorCode) MarshalText ¶
func (*ErrorCode) UnmarshalText ¶
func (ErrorCode) WithDetail ¶
func (ErrorCode) WithMessage ¶
type ErrorCoder ¶
type ErrorCoder interface {
ErrorCode() ErrorCode
}
type ErrorDescriptor ¶
Click to show internal directories.
Click to hide internal directories.