exception

package
v0.0.0-...-7a62f64 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SmithyErrorTypeHeader = "X-Amzn-Errortype"
)

Variables

This section is empty.

Functions

func ResponseHandler

func ResponseHandler(ctx context.Context, w http.ResponseWriter, r *http.Request, err error)

func ResponseHandlerWithLogger

func ResponseHandlerWithLogger(lvl zerolog.Level) func(ctx context.Context, w http.ResponseWriter, r *http.Request, err error)

func UnknownOperationHandler

func UnknownOperationHandler(w http.ResponseWriter, r *http.Request)

Types

type Exception

type Exception struct {
	HttpCode      int
	ExceptionType ExceptionType
	Message       string
}

func FromError

func FromError(err error) *Exception

func NewInternalFailureException

func NewInternalFailureException(msg string) *Exception

func NewInternalServerException

func NewInternalServerException(msg string) *Exception

func NewInvalidInputError

func NewInvalidInputError(msg string) *Exception

func NewResourceNotFoundError

func NewResourceNotFoundError(msg string) *Exception

func NewSerializationException

func NewSerializationException(msg string) *Exception

func NewUnauthorizedError

func NewUnauthorizedError(msg string) *Exception

func NewUnknownOperationException

func NewUnknownOperationException(msg string) *Exception

func NewValidationError

func NewValidationError(msg string) *Exception

func (*Exception) AsJsonMessage

func (e *Exception) AsJsonMessage() []byte

func (*Exception) Code

func (e *Exception) Code() int

func (*Exception) Error

func (e *Exception) Error() string

func (*Exception) Type

func (e *Exception) Type() ExceptionType

type ExceptionType

type ExceptionType int
const (
	ExceptionTypeInternalServerException ExceptionType = iota
	ExceptionTypeUnauthorizedException
	ExceptionTypeInvalidInputException
	ExceptionTypeResourceNotFoundException
	ExceptionTypeInternalFailureException
	ExceptionTypeSerializationException
	ExceptionTypeUnknownOperationException
	ExceptionTypeValidationException
)

func (ExceptionType) String

func (e ExceptionType) String() string

Jump to

Keyboard shortcuts

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