Documentation
¶
Index ¶
- func As(err error, target *Error) bool
- func GetHTTPStatus(errType ErrorType) int
- func Is(err error, errorType ErrorType) bool
- func RegisterHTTPStatusMapping(errType ErrorType, httpStatus int)
- func Unwarp(err error) error
- type Error
- func (e *Error) AppendKVs(kvs ...string) *Error
- func (e *Error) Error() string
- func (e *Error) HttpStatus() int
- func (e *Error) ToJSON() string
- func (e *Error) Unwrap() error
- func (e *Error) WithCode(code int) *Error
- func (e *Error) WithMeta(mp map[string]string) *Error
- func (e *Error) WithReason(err error) *Error
- type ErrorType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetHTTPStatus ¶
Types ¶
type Error ¶
type Error struct {
Type ErrorType `json:"type,omitempty"`
Code int `json:"code,omitempty"`
Msg string `json:"message,omitempty"`
Reason error `json:"-"`
MetaKV map[string]string `json:"meta,omitempty"`
StackTrace string `json:"stack_trace,omitempty"`
}
func (*Error) HttpStatus ¶
func (*Error) WithReason ¶
Click to show internal directories.
Click to hide internal directories.