apierrors

package
v0.1.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleAPIError

func HandleAPIError(
	l logger.Logger,
	alerter erroralerter.Alerter,
	w http.ResponseWriter,
	r *http.Request,
	err RequestError,
	writeErr bool,
	opts ...ErrorOpts,
)

Types

type ErrForbidden

type ErrForbidden struct {
	// contains filtered or unexported fields
}

func (*ErrForbidden) APIError

func (e *ErrForbidden) APIError() types.APIErrors

func (*ErrForbidden) Error

func (e *ErrForbidden) Error() string

func (*ErrForbidden) GetStatusCode

func (e *ErrForbidden) GetStatusCode() int

func (*ErrForbidden) InternalError

func (e *ErrForbidden) InternalError() string

type ErrInternal

type ErrInternal struct {
	// contains filtered or unexported fields
}

func (*ErrInternal) APIError

func (e *ErrInternal) APIError() types.APIErrors

func (*ErrInternal) Error

func (e *ErrInternal) Error() string

func (*ErrInternal) GetStatusCode

func (e *ErrInternal) GetStatusCode() int

func (*ErrInternal) InternalError

func (e *ErrInternal) InternalError() string

type ErrNotFound

type ErrNotFound struct {
	// contains filtered or unexported fields
}

errors that denote that a resource was not found

func (*ErrNotFound) APIError

func (e *ErrNotFound) APIError() types.APIErrors

func (*ErrNotFound) Error

func (e *ErrNotFound) Error() string

func (*ErrNotFound) GetStatusCode

func (e *ErrNotFound) GetStatusCode() int

func (*ErrNotFound) InternalError

func (e *ErrNotFound) InternalError() string

type ErrPassThroughToClient

type ErrPassThroughToClient struct {
	// contains filtered or unexported fields
}

errors that should be passed directly, with no filter

func (*ErrPassThroughToClient) APIError

func (e *ErrPassThroughToClient) APIError() types.APIErrors

func (*ErrPassThroughToClient) Error

func (e *ErrPassThroughToClient) Error() string

func (*ErrPassThroughToClient) GetStatusCode

func (e *ErrPassThroughToClient) GetStatusCode() int

func (*ErrPassThroughToClient) InternalError

func (e *ErrPassThroughToClient) InternalError() string

type ErrorOpts

type ErrorOpts struct {
	Code uint
}

type RequestError

type RequestError interface {
	Error() string
	APIError() types.APIErrors
	InternalError() string
	GetStatusCode() int
}

func NewErrForbidden

func NewErrForbidden(err error) RequestError

func NewErrInternal

func NewErrInternal(err error) RequestError

func NewErrNotFound

func NewErrNotFound(err error) RequestError

func NewErrPassThroughToClient

func NewErrPassThroughToClient(apiError types.APIError, statusCode int, details ...string) RequestError

func NewErrPassThroughToClientMulti

func NewErrPassThroughToClientMulti(apiErrors types.APIErrors, statusCode int, details ...string) RequestError

Jump to

Keyboard shortcuts

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