errors

package
v0.0.0-...-9d3c944 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//ProblemReportContentType as required by https://tools.ietf.org/html/rfc7807
	ProblemReportContentType string = "application/problem+json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DetailsFunc

type DetailsFunc func(p *problem) *problem

func Detail

func Detail(detail string) DetailsFunc

func Instance

func Instance(instance string) DetailsFunc

func InvalidParameter

func InvalidParameter(property string, value any, reason string) DetailsFunc

func Title

func Title(t string) DetailsFunc

func TraceID

func TraceID(traceID string) DetailsFunc

type ProblemDetails

type ProblemDetails interface {
	Code() int
	Type() string
	Title() string
	Detail() string
	Instance() string
	TraceID() string

	ContentType() string
	WriteResponse(w http.ResponseWriter) error
}

ProblemDetails stores details about a certain problem according to RFC7807 See https://tools.ietf.org/html/rfc7807

func NewProblemReport

func NewProblemReport(code int, problemType string, details ...DetailsFunc) ProblemDetails

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL