errors

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2019 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsInternalError

func IsInternalError(err error) bool

IsInternalError determines if err is an error which indicates an internal server error.

func IsUnauthorized

func IsUnauthorized(err error) bool

IsUnauthorized determines if err is an error which indicates that the request is unauthorized and requires authentication by the user.

func ReasonForError

func ReasonForError(err error) int

ReasonForError returns the HTTP status for a particular error.

Types

type APIStatus

type APIStatus interface {
	Status() int
}

APIStatus is exposed by errors that can be converted to an api.Status object for finer grained details.

type StatusError

type StatusError struct {
	HTTPStatus int
	Message    string
}

func NewInternalError

func NewInternalError(err error) *StatusError

NewInternalError returns an error indicating the item is invalid and cannot be processed.

func NewUnauthorized

func NewUnauthorized(reason string) *StatusError

NewUnauthorized returns an error indicating the client is not authorized to perform the requested action.

func (*StatusError) Error

func (e *StatusError) Error() string

func (*StatusError) Status

func (e *StatusError) Status() int

Status allows access to e's http status without having to know the detailed workings of StatusError.

Jump to

Keyboard shortcuts

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