api_responses

package
v1.206.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ContentTypeJSONHeader = map[string]string{"Content-Type": "application/json"}

Functions

func ClientError

func ClientError(status int, message string) (events.APIGatewayProxyResponse, error)

ClientError creates responses due to request client error

func DatabaseServerError

func DatabaseServerError(err error, msg string) (events.APIGatewayProxyResponse, error)

func DatabaseServerErrorNew

func DatabaseServerErrorNew(err error, msg string) error

func Error

func Error(err error, msg string, statusCode int) (events.APIGatewayProxyResponse, error)

func ErrorFromDBError

func ErrorFromDBError(err error) string

func GenericJSONResponseWithContentAndHeaders added in v1.124.0

func GenericJSONResponseWithContentAndHeaders(code int, content string, headers map[string]string) events.APIGatewayProxyResponse

func GenericJSONResponseWithMessage added in v1.166.0

func GenericJSONResponseWithMessage(code int, err error) events.APIGatewayProxyResponse

func NewServerError

func NewServerError(err error, msg string) error

func ServerError

func ServerError(err error, msg string) (events.APIGatewayProxyResponse, error)

ServerError logs any error to os.Stderr and returns 500 Internal Server Error response that the AWS API Gateway understands.

func StatusCodeFromSQLError

func StatusCodeFromSQLError(err error) int

func TimeResponse added in v1.192.0

func TimeResponse() events.APIGatewayProxyResponse

Types

type ServerErrorStruct

type ServerErrorStruct struct {
	Message string
	// contains filtered or unexported fields
}

implements error so that API handler can extract the msg

Jump to

Keyboard shortcuts

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