problemdetail

package
v0.0.0-...-aca1c39 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Map

func Map[T error](funcProblem func() ProblemDetailErr)

Map map custom type error to problem details error

func MapStatus

func MapStatus(statusCode int, funcProblem func() ProblemDetailErr)

MapStatus map status code to problem details error

Types

type ProblemDetail

type ProblemDetail struct {
	Status     int    `json:"status,omitempty"`
	Title      string `json:"title,omitempty"`
	Detail     string `json:"detail,omitempty"`
	Type       string `json:"type,omitempty"`
	Instance   string `json:"instance,omitempty"`
	StackTrace string `json:"stackTrace,omitempty"`
}

func (*ProblemDetail) GetDetails

func (p *ProblemDetail) GetDetails() string

func (*ProblemDetail) GetInstance

func (p *ProblemDetail) GetInstance() string

func (*ProblemDetail) GetStackTrace

func (p *ProblemDetail) GetStackTrace() string

func (*ProblemDetail) GetStatus

func (p *ProblemDetail) GetStatus() int

func (*ProblemDetail) GetTitle

func (p *ProblemDetail) GetTitle() string

func (*ProblemDetail) GetType

func (p *ProblemDetail) GetType() string

func (*ProblemDetail) SetDetail

func (p *ProblemDetail) SetDetail(detail string) ProblemDetailErr

func (*ProblemDetail) SetInstance

func (p *ProblemDetail) SetInstance(instance string) ProblemDetailErr

func (*ProblemDetail) SetStackTrace

func (p *ProblemDetail) SetStackTrace(stackTrace string) ProblemDetailErr

func (*ProblemDetail) SetStatus

func (p *ProblemDetail) SetStatus(status int) ProblemDetailErr

func (*ProblemDetail) SetTitle

func (p *ProblemDetail) SetTitle(title string) ProblemDetailErr

func (*ProblemDetail) SetType

func (p *ProblemDetail) SetType(typ string) ProblemDetailErr

type ProblemDetailErr

type ProblemDetailErr interface {
	SetStatus(status int) ProblemDetailErr
	GetStatus() int
	SetTitle(title string) ProblemDetailErr
	GetTitle() string
	SetDetail(detail string) ProblemDetailErr
	GetDetails() string
	SetType(typ string) ProblemDetailErr
	GetType() string
	SetInstance(instance string) ProblemDetailErr
	GetInstance() string
	SetStackTrace(stackTrace string) ProblemDetailErr
	GetStackTrace() string
}

ProblemDetailErr ProblemDetail error interface

func ResolveProblemDetails

func ResolveProblemDetails(w http.ResponseWriter, r *http.Request, err error) (ProblemDetailErr, error)

ResolveProblemDetails retrieve and resolve error with format problem details error

Jump to

Keyboard shortcuts

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