Documentation ¶
Index ¶
- Constants
- func SendError(w http.ResponseWriter, r *http.Request, error *Error)
- func SendPanic(w http.ResponseWriter, r *http.Request)
- type Error
- func (e *Error) Code() string
- func (e *Error) Error() string
- func (e *Error) GetCode() (value string, ok bool)
- func (e *Error) GetHREF() (value string, ok bool)
- func (e *Error) GetID() (value string, ok bool)
- func (e *Error) GetReason() (value string, ok bool)
- func (e *Error) HREF() string
- func (e *Error) ID() string
- func (e *Error) Kind() string
- func (e *Error) MarshalError(destination interface{}) error
- func (e *Error) Reason() string
- type ErrorBuilder
Constants ¶
const ErrorKind = "Error"
Error kind is the name of the type used to represent errors.
const ErrorNilKind = "ErrorNil"
ErrorNilKind is the name of the type used to nil errors.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error represents errors.
func UnmarshalError ¶
UnmarshalError reads an error from the given which can be an slice of bytes, a string, a reader or a JSON decoder.
func (*Error) GetCode ¶
GetCode returns the link of the error and a flag indicating if the code has a value.
func (*Error) GetHREF ¶
GetHREF returns the link of the error and a flag indicating if the link has a value.
func (*Error) GetID ¶
GetID returns the identifier of the error and a flag indicating if the identifier has a value.
func (*Error) GetReason ¶
GetReason returns the link of the error and a flag indicating if the reason has a value.
func (*Error) MarshalError ¶ added in v0.1.30
MarshalError writes an error to the given destination which can be an slice of bytes, a string, a reader or a JSON decoder.
type ErrorBuilder ¶
type ErrorBuilder struct {
// contains filtered or unexported fields
}
ErrorBuilder is a builder for the error type.
func (*ErrorBuilder) Build ¶
func (e *ErrorBuilder) Build() (*Error, error)
Build builds a new error type or returns an error.
func (*ErrorBuilder) Code ¶
func (e *ErrorBuilder) Code(code string) *ErrorBuilder
Code sets the cpde field for the ErrorBuilder
func (*ErrorBuilder) HREF ¶
func (e *ErrorBuilder) HREF(href string) *ErrorBuilder
HREF sets the href field for the ErrorBuilder
func (*ErrorBuilder) ID ¶
func (e *ErrorBuilder) ID(id string) *ErrorBuilder
ID sets the id field for the ErrorBuilder
func (*ErrorBuilder) Reason ¶
func (e *ErrorBuilder) Reason(reason string) *ErrorBuilder
Reason sets the reason field for the ErrorBuilder