errors

package
v0.0.0-...-b9b4979 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound       = errors.New("not found")
	ErrDb             = errors.New("database error")
	ErrValidation     = errors.New("validation failed")
	ErrAuthentication = errors.New("missing or wrong credentials")
	ErrAuthorization  = errors.New("authorization error")
	ErrBodyDecode     = errors.New("body decode failed")
	ErrBodyEncode     = errors.New("body encode failed")
	ErrPathParameter  = errors.New("path parameter error")
	ErrNotAllowed     = errors.New("method not allowed")
)

Functions

func Handle

func Handle(handler Handler, logger log.Logger) httprouter.Handle

Handle creates middleware for handling errors and panics encountered during request handling

Types

type Handler

Handler type represents handler that can return error. It's intended to be wrapped in error.Handle handler

type Problem

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

Problem represents error description. Conforms RFC7807

Jump to

Keyboard shortcuts

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