errors

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyToken = NewRestError(401, "EmptyToken")
View Source
var ErrExpired = NewRestError(401, "Expired")
View Source
var ErrInvalidToken = NewRestError(401, "InvalidToken")
View Source
var ErrMapTokenClaims = NewRestError(500, "FailedMapTokenClaims")
View Source
var ErrNotFound = NewRestError(404, "NotFound")
View Source
var ErrUnauthorized = NewRestError(401, "UnAuthorized")

Functions

func Wrap

func Wrap(err error, args ...interface{}) error

func WrapTx

func WrapTx(tx driver.Tx, err error) error

func Wrapf

func Wrapf(format string, a ...interface{}) error

Types

type RestError

type RestError struct {
	Code          int    `json:"code"`
	Message       string `json:"message"`
	OriginalError error  `json:"-"`
}

RestError represents a Rest HTTP Error that can be returned from a controller

func BadRequest

func BadRequest(message string) RestError

func BadRequestf

func BadRequestf(format string, a ...interface{}) RestError

func NewRestError

func NewRestError(code int, format string, a ...interface{}) RestError

func NotFound

func NotFound(message string) RestError

func NotFoundf

func NotFoundf(format string, a ...interface{}) RestError

func (RestError) Error

func (re RestError) Error() string

func (RestError) IsHyperError

func (re RestError) IsHyperError() bool

func (RestError) Unwrap

func (re RestError) Unwrap() error

type UnexpectStatusCodeError

type UnexpectStatusCodeError struct {
	UnexpectedCode int
	OriginalError  error
}

func UnexpectedStatusCode

func UnexpectedStatusCode(status int, err error) UnexpectStatusCodeError

func (UnexpectStatusCodeError) Error

func (e UnexpectStatusCodeError) Error() string

Jump to

Keyboard shortcuts

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