httperror

package
v1.0.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknown = func(err error) *Error {
		return New(http.StatusInternalServerError, "unknown error", err)
	}

	ErrMissingParams = func(err error) *Error {
		return New(http.StatusBadRequest, "mandatory parameters are missing or invalid", err)
	}

	ErrAppInvalid = func(err error) *Error {
		return New(http.StatusNotFound, "invalid app or credentials", err)
	}

	ErrAppUnsupported = func(err error) *Error {
		return New(http.StatusBadRequest, "app is not supported", err)
	}

	ErrUnauthorized = func(err error) *Error {
		return New(http.StatusUnauthorized, "unauthorized", err)
	}

	ErrBadRequest = func(err error) *Error {
		return New(http.StatusBadRequest, "bad request", err)
	}

	ErrUpstreamFailed = func(err error) *Error {
		return New(http.StatusBadGateway, "failed to proxy request", err)
	}
)

Functions

This section is empty.

Types

type Error

type Error struct {
	Code    int    `json:"-"`
	Message string `json:"message"`
	Err     error  `json:"-"`
}

func New

func New(code int, message string, err error) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

Jump to

Keyboard shortcuts

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