Documentation
¶
Index ¶
- func Is(err error) bool
- func StatusCodeFromCode(code int) int
- type Error
- type ErrorField
- type ErrorFields
- type ServiceCode
- type StatusErr
- func (se StatusErr) AppendErrorField(in string, field string, msg string) *StatusErr
- func (se StatusErr) AppendErrorFields(errorFields ...*ErrorField) *StatusErr
- func (se StatusErr) AppendSource(source string) *StatusErr
- func (se StatusErr) DisableErrTalk() *StatusErr
- func (se StatusErr) EnableErrTalk() *StatusErr
- func (se *StatusErr) Error() string
- func (se *StatusErr) Is(err error) bool
- func (se *StatusErr) StatusCode() int
- func (se *StatusErr) Summary() string
- func (se *StatusErr) Unwrap() error
- func (se StatusErr) WithDesc(desc string) *StatusErr
- func (se StatusErr) WithID(id string) *StatusErr
- func (se StatusErr) WithMsg(msg string) *StatusErr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StatusCodeFromCode ¶
Types ¶
type ErrorField ¶
type ErrorField struct {
Field string `json:"field" xml:"field"` // Field path: prop.slice[2].a
Msg string `json:"msg" xml:"msg"` // Msg message
In string `json:"in" xml:"in"` // In location eq. body, query, header, path, formData
}
func NewErrorField ¶
func NewErrorField(in string, field string, msg string) *ErrorField
func (ErrorField) String ¶
func (s ErrorField) String() string
type ErrorFields ¶
type ErrorFields []*ErrorField
func (ErrorFields) String ¶
func (fs ErrorFields) String() string
type ServiceCode ¶
type ServiceCode interface {
ServiceCode() int
}
type StatusErr ¶
type StatusErr struct {
Key string `json:"key" xml:"key"`
Code int `json:"code" xml:"code"` // unique err code
Msg string `json:"msg" xml:"msg"` // msg of err
Desc string `json:"desc" xml:"desc"` // desc of err
CanBeTalk bool `json:"canBeTalk" xml:"canBeTalk"` // can be task error; for client to should error msg to end user
ID string `json:"id" xml:"id"` // request ID or other request context
Sources []string `json:"sources" xml:"sources"` // error tracing
Fields ErrorFields `json:"fields" xml:"fields"` // error in where fields
// contains filtered or unexported fields
}
func ParseSummary ¶
func UnknownErr ¶
func (StatusErr) AppendErrorField ¶
func (StatusErr) AppendErrorFields ¶
func (se StatusErr) AppendErrorFields(errorFields ...*ErrorField) *StatusErr
func (StatusErr) AppendSource ¶
func (StatusErr) DisableErrTalk ¶
func (StatusErr) EnableErrTalk ¶
func (*StatusErr) StatusCode ¶
Click to show internal directories.
Click to hide internal directories.