errs

package
v0.0.0-...-16f8954 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OK              = "200"
	Created         = "201"
	ErrBadRequest   = "400"
	ErrUnauthorized = "401"
	ErrForbidden    = "403"
	ErrNotFound     = "404"
	ErrServerError  = "500"
	ErrConflict     = "409"
)

HTTP status codes

Variables

This section is empty.

Functions

func New

func New(err error, status string) error

New - returns a new AffsError based on error provided + given status code

func StatusText

func StatusText(code string) string

StatusText returns the status code in human text

func Wrap

func Wrap(err error, message string) error

Wrap creates a new error with the same static code if present

Types

type AffsError

type AffsError struct {
	Message string
	Status  string
}

AffsError is an error type that also holds a status code

func (AffsError) Code

func (m AffsError) Code() string

Code implements coded response interface in swagger

func (AffsError) Error

func (m AffsError) Error() string

Error implements the error interface

type CodedError

type CodedError interface {
	Code() string
	error
}

CodedError represents an error with a code

Jump to

Keyboard shortcuts

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