smithy_errors

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 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 ErrorType

type ErrorType int
const (
	ErrorTypeInternalServerError ErrorType = iota
	ErrorTypeUnauthorizedError
	ErrorTypeInvalidInputError
	ErrorTypeResourceNotFoundError
	ErrorTypeInternalFailureError
	ErrorTypeSerializationError
	ErrorTypeUnknownOperationError
	ErrorTypeValidationError
)

func (ErrorType) String

func (e ErrorType) String() string

type SmithyError

type SmithyError struct {
	HttpCode  int
	ErrorType ErrorType
	Message   string
}

func NewInternalFailureError

func NewInternalFailureError(msg string) *SmithyError

func NewInvalidInputError

func NewInvalidInputError(msg string) *SmithyError

func NewResourceNotFoundError

func NewResourceNotFoundError(msg string) *SmithyError

func NewSerializationError

func NewSerializationError(msg string) *SmithyError

func NewUnauthorizedError

func NewUnauthorizedError(msg string) *SmithyError

func NewUnknownOperationError

func NewUnknownOperationError(msg string) *SmithyError

func (*SmithyError) AsJsonMessage

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

func (*SmithyError) Code

func (e *SmithyError) Code() int

func (*SmithyError) Error

func (e *SmithyError) Error() string

func (*SmithyError) Type

func (e *SmithyError) Type() ErrorType

Jump to

Keyboard shortcuts

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