Documentation ¶
Index ¶
- func E(args ...interface{}) error
- func Errorf(format string, args ...interface{}) error
- func Match(errs1, errs2 error) bool
- func WithCodes(codes Codes) error
- type Codes
- type Error
- type Fields
- type Op
- type RequestError
- func (re *RequestError) AppendData(key string, data interface{}) *RequestError
- func (re *RequestError) Error() string
- func (re *RequestError) GetCode() int
- func (re *RequestError) GetData() map[string]interface{}
- func (re *RequestError) GetMessage() string
- func (re *RequestError) SetCode(code int) *RequestError
- func (re *RequestError) SetMessage(msg string) *RequestError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Codes ¶
Codes is interface to define error custom code. It have two function called ErrorAndCode which return string of error and httpcode desired from the error Err will return the error of code itself, so error can be implemented directly in Codes
type Error ¶
type Error struct { Err error // Codes used for Errs to identify known errors in the application // If the error is expected by Errs object, the errors will be shown as listed in Codes Code Codes // Traces used to add function traces to errors, this is different from context // While context is used to add more information about the error, traces is used // for easier function tracing purposes without hurting heap too much Traces []string // Fields is a fields context similar to logrus.Fields // Can be used for adding more context to the errors Fields Fields // Op is operaions of error Op Op // OpTraces is a trace of operations OpTraces []Op }
Error struct
type Fields ¶
type Fields map[string]interface{}
Fields of error
func (Fields) ToArrayInterface ¶
func (f Fields) ToArrayInterface() []interface{}
ToArrayInterface fields
type RequestError ¶
type RequestError struct {
// contains filtered or unexported fields
}
func New ¶
func New(err error) *RequestError
func (*RequestError) AppendData ¶
func (re *RequestError) AppendData(key string, data interface{}) *RequestError
func (*RequestError) Error ¶
func (re *RequestError) Error() string
func (*RequestError) GetCode ¶
func (re *RequestError) GetCode() int
func (*RequestError) GetData ¶
func (re *RequestError) GetData() map[string]interface{}
func (*RequestError) GetMessage ¶ added in v0.5.14
func (re *RequestError) GetMessage() string
func (*RequestError) SetCode ¶
func (re *RequestError) SetCode(code int) *RequestError
func (*RequestError) SetMessage ¶ added in v0.5.14
func (re *RequestError) SetMessage(msg string) *RequestError
Click to show internal directories.
Click to hide internal directories.