problem

package
v0.0.0-...-1491fc7 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MyCaller

func MyCaller() string

MyCaller returns the caller of the function that called it

Types

type Problem

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

Problem in RFC-7807 format

func New

func New(typeStr string, title string, status int, detail, instance string) *Problem

New creates a RFC 7807 problem object

func Wrap

func Wrap(status int, typeStr string, instance string, err error) *Problem

Wrap creates a Problem wrapping an error

func (Problem) Error

func (p Problem) Error() string

Implement error interface

func (*Problem) Send

func (p *Problem) Send(resp http.ResponseWriter)

HTTPSend sends a RFC 7807 problem object as HTTP response

Jump to

Keyboard shortcuts

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