Documentation ¶
Index ¶
- Variables
- func Handler(f interface{}) http.Handler
- func NewError(message string) error
- func NewProtocolError(message string) error
- func NotFound(w http.ResponseWriter, r *http.Request)
- func NotFoundHandler() http.Handler
- func OnError(f func(err error))
- func SetValidate(enable bool)
- func WrapError(err error) error
- type Error
- type FormUnmarshaler
- type MultipartFormUnmarshaler
- type OKError
- type ProtocolError
- type RequestAdapter
- type RequestUnmarshaler
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrUnsupported = NewProtocolError("unsupported content type")
)
predefined errors
Functions ¶
func NewProtocolError ¶
func NotFoundHandler ¶
func SetValidate ¶ added in v1.1.0
func SetValidate(enable bool)
SetValidate sets hrpc manager validate state
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error always return 200 status with false ok value use this error for validate, precondition failed, etc.
func (*Error) MarshalJSON ¶ added in v1.1.0
MarshalJSON implements json.Marshaler
type FormUnmarshaler ¶
FormUnmarshaler interface
type MultipartFormUnmarshaler ¶
MultipartFormUnmarshaler interface
type OKError ¶ added in v1.1.0
type OKError interface {
OKError()
}
OKError implements this interface to mark errors as 200
type ProtocolError ¶
type ProtocolError struct {
Message string `json:"message"`
}
ProtocolError always returns 400 status with false ok value only use this error for invalid protocol usages
func (*ProtocolError) Error ¶
func (err *ProtocolError) Error() string
type RequestAdapter ¶
RequestAdapter converts request to arpc before decode
type RequestUnmarshaler ¶
RequestUnmarshaler interface
Click to show internal directories.
Click to hide internal directories.