Documentation ¶
Index ¶
- Variables
- func ClientError(status int, message string) (events.APIGatewayProxyResponse, error)
- func DatabaseServerError(err error, msg string) (events.APIGatewayProxyResponse, error)
- func DatabaseServerErrorNew(err error, msg string) error
- func Error(err error, msg string, statusCode int) (events.APIGatewayProxyResponse, error)
- func ErrorFromDBError(err error) string
- func GenericJSONResponseWithContentAndHeaders(code int, content string, headers map[string]string) events.APIGatewayProxyResponse
- func GenericJSONResponseWithMessage(code int, err error) events.APIGatewayProxyResponse
- func NewServerError(err error, msg string) error
- func ServerError(err error, msg string) (events.APIGatewayProxyResponse, error)
- func StatusCodeFromSQLError(err error) int
- type ServerErrorStruct
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 ErrorFromDBError ¶
func GenericJSONResponseWithContentAndHeaders ¶ added in v1.124.0
func GenericJSONResponseWithMessage ¶ added in v1.166.0
func GenericJSONResponseWithMessage(code int, err error) events.APIGatewayProxyResponse
func NewServerError ¶
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 ¶
Types ¶
type ServerErrorStruct ¶
type ServerErrorStruct struct { Message string // contains filtered or unexported fields }
implements error so that API handler can extract the msg
Click to show internal directories.
Click to hide internal directories.