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 NewWithCaller(message string) *Error
- func NewWithError(err error) *Error
- func NewWithErrorStatusCode(err error, statusCode int) *Error
- func NewWithStatusCode(message string, statusCode int, category ...string) *Error
- func Wrap(err error) *Error
- func (e *Error) Add(errs ...error)
- 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 {
StatusCode int `json:"statusCode,omitempty"`
Code string `json:"code,omitempty"`
Category string `json:"category,omitempty"`
Message string `json:"message,omitempty"`
Exception bool `json:"exception,omitempty"`
Err error `json:"-"`
// File caller file
File string `json:"file,omitempty"`
// Line caller line
Line int `json:"line,omitempty"`
Extra map[string]interface{} `json:"extra,omitempty"`
Errs []*Error `json:"errs,omitempty"`
}
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 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.