Documentation
¶
Overview ¶
Package problem implements RFC 9457 errors that can be returned from a handler.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorHandler ¶
func ErrorHandler(err error, w http.ResponseWriter)
func WithExtension ¶
WithExtension adds an extension field to the problem.
func WithInstance ¶
func WithInstance(instance string) option
WithInstance sets the instance that identifies the specific occurrence of the problem.
Types ¶
type Problem ¶
type Problem struct { Type string `json:"type"` Title string `json:"title"` Status int `json:"status"` Detail string `json:"detail,omitempty"` Instance string `json:"instance,omitempty"` // Extensions is a map of additional optional members. Extensions map[string]any }
Problem is an error that implements the RFC 9457 problem details.
func New ¶
Createa a new Problem using err and status. The status code should be a valid HTTP status code.
func (*Problem) MarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.