Documentation ¶
Index ¶
- func EnableCaller(enabled bool)
- func IsError(err error) bool
- func SetFileConvertor(fn FileConvertor)
- type Error
- func New(message string, category ...string) *Error
- func NewMutex(message string, category ...string) *Error
- func NewWithCaller(message string) *Error
- func NewWithError(err error) *Error
- func NewWithErrorStatusCode(err error, statusCode int) *Error
- func NewWithException(message string) *Error
- func NewWithStatusCode(message string, statusCode int, category ...string) *Error
- func Wrap(err error) *Error
- func (e *Error) Add(errs ...error)
- func (e *Error) AddExtra(key string, value interface{})
- func (e *Error) Clone() *Error
- func (e *Error) CloneWithMessage(message string) *Error
- func (e *Error) Error() string
- func (e *Error) Format(s fmt.State, verb rune)
- func (e *Error) IsEmpty() bool
- func (e *Error) IsNotEmpty() bool
- func (e *Error) SetCaller(skip int)
- func (e *Error) ToJSON() []byte
- type FileConvertor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Error ¶
type Error struct { // http status code StatusCode int `json:"statusCode,omitempty"` // error code Code string `json:"code,omitempty"` // category Category string `json:"category,omitempty"` // sub category SubCategory string `json:"subCategory,omitempty"` // title Title string `json:"title,omitempty"` // message Message string `json:"message,omitempty"` // exception error Exception bool `json:"exception,omitempty"` // original error Err error `json:"-"` // File caller file File string `json:"file,omitempty"` // Line caller line Line int `json:"line,omitempty"` // extra info for error Extra map[string]interface{} `json:"extra,omitempty"` // sub errors Errs []*Error `json:"errs,omitempty"` // contains filtered or unexported fields }
Error http error
func NewWithCaller ¶
NewWithCaller create a http error with caller
func NewWithErrorStatusCode ¶
NewWithErrorStatusCode create a http error with error and status code
func NewWithException ¶ added in v0.5.1
NewWithException create a http error and set exception to true
func NewWithStatusCode ¶
NewWithStatusCode create a http error with status code
func (*Error) CloneWithMessage ¶
CloneWithMessage clone error and update message
func (*Error) IsNotEmpty ¶
IsNotEmpty check the error list is not empty
type FileConvertor ¶
Click to show internal directories.
Click to hide internal directories.