Documentation ¶
Index ¶
- Variables
- type Error
- func New(err error, t ErrorType, meta interface{}) *Error
- func NewPrivate(err string) *Error
- func NewPrivatef(format string, v ...interface{}) *Error
- func NewPublic(err string) *Error
- func NewPublicf(format string, v ...interface{}) *Error
- func Newf(t ErrorType, meta interface{}, format string, v ...interface{}) *Error
- type ErrorChain
- type ErrorType
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // These errors are the base error, which are used for checking in errors.Is() ErrNeedMore = errors.New("need more data") ErrChunkedStream = errors.New("chunked stream") ErrBodyTooLarge = errors.New("body size exceeds the given limit") ErrHijacked = errors.New("connection has been hijacked") ErrIdleTimeout = errors.New("idle timeout") ErrTimeout = errors.New("timeout") ErrReadTimeout = errors.New("read timeout") ErrWriteTimeout = errors.New("write timeout") ErrDialTimeout = errors.New("dial timeout") ErrNothingRead = errors.New("nothing read") ErrShortConnection = errors.New("short connection") ErrNoFreeConns = errors.New("no free connections available to host") ErrConnectionClosed = errors.New("connection closed") ErrNotSupportProtocol = errors.New("not support protocol") ErrNoMultipartForm = errors.New("request has no multipart/form-data Content-Type") )
Functions ¶
This section is empty.
Types ¶
type Error ¶
func NewPrivate ¶
func NewPrivatef ¶ added in v0.4.0
func NewPublicf ¶ added in v0.4.0
type ErrorChain ¶
type ErrorChain []*Error
func (ErrorChain) ByType ¶
func (a ErrorChain) ByType(typ ErrorType) ErrorChain
ByType returns a readonly copy filtered the byte. ie ByType(hertz.ErrorTypePublic) returns a slice of errors with type=ErrorTypePublic.
func (ErrorChain) Errors ¶
func (a ErrorChain) Errors() []string
Errors returns an array will all the error messages. Example:
c.Error(errors.New("first")) c.Error(errors.New("second")) c.Error(errors.New("third")) c.Errors.Errors() // == []string{"first", "second", "third"}
func (ErrorChain) JSON ¶
func (a ErrorChain) JSON() interface{}
func (ErrorChain) Last ¶
func (a ErrorChain) Last() *Error
Last returns the last error in the slice. It returns nil if the array is empty. Shortcut for errors[len(errors)-1].
func (ErrorChain) String ¶
func (a ErrorChain) String() string
type ErrorType ¶
type ErrorType uint64
ErrorType is an unsigned 64-bit error code as defined in the hertz spec.
const ( // ErrorTypeBind is used when Context.Bind() fails. ErrorTypeBind ErrorType = 1 << iota // ErrorTypeRender is used when Context.Render() fails. ErrorTypeRender // ErrorTypePrivate indicates a private error. ErrorTypePrivate // ErrorTypePublic indicates a public error. ErrorTypePublic // ErrorTypeAny indicates any other error. ErrorTypeAny )
Click to show internal directories.
Click to hide internal directories.