Documentation ¶
Index ¶
- Constants
- func Map[E error](problem ProblemDetailFunc[E])
- func WriteTo(p ProblemDetailErr, w http.ResponseWriter) (int, error)
- type OptionBuilder
- type ProblemDetailErr
- func NewApiProblemDetail(status int, detail string, stackTrace string) ProblemDetailErr
- func NewApplicationProblemDetail(status int, detail string, stackTrace string) ProblemDetailErr
- func NewBadRequestProblemDetail(detail string, stackTrace string) ProblemDetailErr
- func NewConflictProblemDetail(detail string, stackTrace string) ProblemDetailErr
- func NewDomainProblemDetail(status int, detail string, stackTrace string) ProblemDetailErr
- func NewForbiddenProblemDetail(detail string, stackTrace string) ProblemDetailErr
- func NewInternalServerProblemDetail(detail string, stackTrace string) ProblemDetailErr
- func NewNotFoundErrorProblemDetail(detail string, stackTrace string) ProblemDetailErr
- func NewProblemDetail(status int, title string, detail string, stackTrace string) ProblemDetailErr
- func NewProblemDetailFromCode(status int, stackTrace string) ProblemDetailErr
- func NewProblemDetailFromCodeAndDetail(status int, detail string, stackTrace string) ProblemDetailErr
- func NewUnAuthorizedErrorProblemDetail(detail string, stackTrace string) ProblemDetailErr
- func NewValidationProblemDetail(detail string, stackTrace string) ProblemDetailErr
- func ParseError(err error) ProblemDetailErr
- func ResolveProblemDetail(err error) ProblemDetailErr
- type ProblemDetailFunc
- type ProblemDetailParser
Constants ¶
View Source
const (
ContentTypeJSON = "application_exceptions/problem+json"
)
Variables ¶
This section is empty.
Functions ¶
func Map ¶
func Map[E error](problem ProblemDetailFunc[E])
func WriteTo ¶
func WriteTo(p ProblemDetailErr, w http.ResponseWriter) (int, error)
WriteTo writes the JSON Problem to an HTTP Response Writer
Types ¶
type OptionBuilder ¶
type OptionBuilder struct {
// contains filtered or unexported fields
}
func NewOptionBuilder ¶
func NewOptionBuilder() *OptionBuilder
func (*OptionBuilder) Build ¶
func (p *OptionBuilder) Build() map[reflect.Type]func(err error) ProblemDetailErr
func (*OptionBuilder) Map ¶
func (p *OptionBuilder) Map(srcErrorType reflect.Type, problem ProblemDetailFunc[error]) *OptionBuilder
type ProblemDetailErr ¶
type ProblemDetailErr interface { GetStatus() int SetStatus(status int) ProblemDetailErr GetTitle() string SetTitle(title string) ProblemDetailErr GetStackTrace() string SetStackTrace(stackTrace string) ProblemDetailErr GetDetail() string SetDetail(detail string) ProblemDetailErr GetType() string SetType(typ string) ProblemDetailErr Error() string ErrBody() error }
ProblemDetailErr ProblemDetail error interface
func NewApiProblemDetail ¶
func NewApiProblemDetail(status int, detail string, stackTrace string) ProblemDetailErr
func NewApplicationProblemDetail ¶
func NewApplicationProblemDetail(status int, detail string, stackTrace string) ProblemDetailErr
func NewBadRequestProblemDetail ¶
func NewBadRequestProblemDetail(detail string, stackTrace string) ProblemDetailErr
func NewConflictProblemDetail ¶
func NewConflictProblemDetail(detail string, stackTrace string) ProblemDetailErr
func NewDomainProblemDetail ¶
func NewDomainProblemDetail(status int, detail string, stackTrace string) ProblemDetailErr
func NewForbiddenProblemDetail ¶
func NewForbiddenProblemDetail(detail string, stackTrace string) ProblemDetailErr
func NewInternalServerProblemDetail ¶
func NewInternalServerProblemDetail(detail string, stackTrace string) ProblemDetailErr
func NewNotFoundErrorProblemDetail ¶
func NewNotFoundErrorProblemDetail(detail string, stackTrace string) ProblemDetailErr
func NewProblemDetail ¶
func NewProblemDetail(status int, title string, detail string, stackTrace string) ProblemDetailErr
NewProblemDetail New ProblemDetail Error
func NewProblemDetailFromCode ¶
func NewProblemDetailFromCode(status int, stackTrace string) ProblemDetailErr
NewProblemDetailFromCode New ProblemDetail Error With Message
func NewProblemDetailFromCodeAndDetail ¶
func NewProblemDetailFromCodeAndDetail( status int, detail string, stackTrace string, ) ProblemDetailErr
NewProblemDetailFromCodeAndDetail New ProblemDetail Error With Message
func NewUnAuthorizedErrorProblemDetail ¶
func NewUnAuthorizedErrorProblemDetail(detail string, stackTrace string) ProblemDetailErr
func NewValidationProblemDetail ¶
func NewValidationProblemDetail(detail string, stackTrace string) ProblemDetailErr
func ParseError ¶
func ParseError(err error) ProblemDetailErr
func ResolveProblemDetail ¶
func ResolveProblemDetail(err error) ProblemDetailErr
type ProblemDetailFunc ¶
type ProblemDetailFunc[E error] func(err E) ProblemDetailErr
type ProblemDetailParser ¶
type ProblemDetailParser struct {
// contains filtered or unexported fields
}
func NewProblemDetailParser ¶
func NewProblemDetailParser(builder func(builder *OptionBuilder)) *ProblemDetailParser
func (*ProblemDetailParser) ResolveError ¶
func (p *ProblemDetailParser) ResolveError(err error) ProblemDetailErr
Click to show internal directories.
Click to hide internal directories.