Documentation ¶
Index ¶
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") ErrNothingRead = errors.New("nothing read") ErrShortConnection = errors.New("short connection") )
Functions ¶
This section is empty.
Types ¶
type Error ¶
func NewPrivate ¶
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.