lambda

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorType

type ErrorType string

ErrorType represents the type of error

const (
	// ErrorTypeInvalidRequest represents an invalid request error
	ErrorTypeInvalidRequest ErrorType = "InvalidRequest"
	// ErrorTypeUnauthorized represents an unauthorized error
	ErrorTypeUnauthorized ErrorType = "Unauthorized"
	// ErrorTypeForbidden represents a forbidden error
	ErrorTypeForbidden ErrorType = "Forbidden"
	// ErrorTypeNotFound represents a not found error
	ErrorTypeNotFound ErrorType = "NotFound"
	// ErrorTypeMethodNotAllowed represents a method not allowed error
	ErrorTypeMethodNotAllowed ErrorType = "MethodNotAllowed"
	// ErrorTypeConflict represents a conflict error
	ErrorTypeConflict ErrorType = "Conflict"
	// ErrorTypeInternalServer represents an internal server error
	ErrorTypeInternalServer ErrorType = "InternalServerError"
	// ErrorTypeServiceUnavailable represents a service unavailable error
	ErrorTypeServiceUnavailable ErrorType = "ServiceUnavailable"
	// ErrorTypeValidationFailed represents a validation failed error
	ErrorTypeValidationFailed ErrorType = "ValidationFailed"
	// ErrorTypeRequestFailed represents a request failed error (typically for downstream requests)
	ErrorTypeRequestFailed ErrorType = "RequestFailed"
)

type LambdaError

type LambdaError struct {
	Type       ErrorType
	Message    string
	StatusCode int
	Err        error
}

LambdaError represents a custom error for Lambda functions

func NewConflictError

func NewConflictError(msg string, err error) *LambdaError

NewConflictError creates a new conflict error

func NewForbiddenError

func NewForbiddenError(msg string, err error) *LambdaError

NewForbiddenError creates a new forbidden error

func NewInternalServerError

func NewInternalServerError(msg string, err error) *LambdaError

NewInternalServerError creates a new internal server error

func NewInvalidRequestError

func NewInvalidRequestError(msg string, err error) *LambdaError

NewInvalidRequestError creates a new invalid request error

func NewMethodNotAllowedError

func NewMethodNotAllowedError() *LambdaError

NewMethodNotAllowedError creates a new method not allowed error

func NewNotFoundError

func NewNotFoundError(msg string, err error) *LambdaError

NewNotFoundError creates a new not found error

func NewRequestFailedError

func NewRequestFailedError(msg string, err error) *LambdaError

NewRequestFailedError creates a new request failed error

func NewServiceUnavailableError

func NewServiceUnavailableError(msg string, err error) *LambdaError

NewServiceUnavailableError creates a new service unavailable error

func NewUnauthorizedError

func NewUnauthorizedError(msg string, err error) *LambdaError

NewUnauthorizedError creates a new unauthorized error

func NewValidationFailedError

func NewValidationFailedError(msg string, err error) *LambdaError

NewValidationFailedError creates a new validation failed error

func (*LambdaError) Error

func (e *LambdaError) Error() string

Error implements the error interface

func (*LambdaError) ToAPIGatewayResponse

func (e *LambdaError) ToAPIGatewayResponse() events.APIGatewayProxyResponse

ToAPIGatewayResponse converts a LambdaError to an APIGatewayProxyResponse

func (*LambdaError) Unwrap

func (e *LambdaError) Unwrap() error

Unwrap returns the wrapped error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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