apperror

package
v0.0.0-...-b412545 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAppError

func NewAppError(options ...ErrorOptions) error

Types

type AppError

type AppError interface {
	Error() string
	ResponseBody() ([]byte, error)
	ResponseHeaders() (int, map[string]string)
}

type ErrorOptions

type ErrorOptions func(*HttpError)

func WithError

func WithError(err error) ErrorOptions

func WithStatusCode

func WithStatusCode(status int) ErrorOptions

type HttpError

type HttpError struct {
	Message string `json:"detail"`
	Status  int    `json:"-"`
}

func (HttpError) Error

func (e HttpError) Error() string

func (HttpError) ResponseBody

func (e HttpError) ResponseBody() ([]byte, error)

func (HttpError) ResponseHeaders

func (e HttpError) ResponseHeaders() (status int, headers map[string]string)

Jump to

Keyboard shortcuts

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