problem

package
v0.0.0-...-822ec7e Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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(url, title string, status int, detail, instance string) *Problem

New creates a RFC 7807 problem object

func NewAPIProblem

func NewAPIProblem(url string, title string, instance string, apiResp *http.Response, err error) *Problem

NewAPIProblem creates a Problem based on either a HTTP resp or an error

func NewCQLProblem

func NewCQLProblem(err error, title string, instance string) *Problem

NewCQLProblem a helper for wrapping errors from gocql

func (Problem) Error

func (p Problem) Error() string

Implement error interface

func (*Problem) Send

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

Send 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