Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidPayload = errors.New("invalid problem") ErrInvalidParameters = errors.New("invalid parameters") ErrUnexpected = errors.New("unexpected error") ErrForbidden = errors.New("forbidden") )
Differents problem issues
View Source
var DefaultForbidden = ForbiddenProblem{ Payload: &Payload{ Type: "about:blank", Title: "Your are missing credentials or have insufficient rights", Status: http.StatusForbidden, }, }
View Source
var DefaultInput = Input{ Payload: &Payload{ Type: "about:blank", Title: "Your parameters didn't validate", Status: http.StatusBadRequest, }, }
View Source
var DefaultUnexpected = UnexpectedProblem{ Payload: &Payload{ Type: "about:blank", Title: "An unexpected error occured decoding request", Status: http.StatusInternalServerError, }, }
Functions ¶
This section is empty.
Types ¶
type ForbiddenProblem ¶ added in v0.2.1
type ForbiddenProblem struct {
*Payload
}
ForbiddenProblem problem
func (ForbiddenProblem) Error ¶ added in v0.2.1
func (f ForbiddenProblem) Error() string
Error implements error interface
func (ForbiddenProblem) Send ¶ added in v0.2.1
func (f ForbiddenProblem) Send(w http.ResponseWriter)
Send implements Problem interface
type Input ¶
type Input struct { *Payload InvalidParams []ParamError `json:"invalid_parameters"` }
Input extends a standard problem problem with invalid parameters
type ParamError ¶
ParamError describe an error on a specific parameter
type Payload ¶
type Payload struct { Type string `json:"type"` Title string `json:"title"` Status int `json:"status"` }
Payload represents most basic problem of an `application/problem+json` response.
func (Payload) Send ¶ added in v0.2.3
func (p Payload) Send(w http.ResponseWriter)
Send implements Problem
type Problem ¶
type Problem interface {
Send(http.ResponseWriter)
}
type UnexpectedProblem ¶
type UnexpectedProblem struct {
*Payload
}
UnexpectedProblem problem
func (UnexpectedProblem) Error ¶
func (u UnexpectedProblem) Error() string
Error implements error interface
func (UnexpectedProblem) Send ¶
func (u UnexpectedProblem) Send(w http.ResponseWriter)
Send implements Problem interface
Click to show internal directories.
Click to hide internal directories.