Skip to content
Snippets Groups Projects
Commit 0519da16 authored by Johan de Klerk's avatar Johan de Klerk
Browse files

Check for error type

parent 96903bce
No related branches found
No related tags found
No related merge requests found
......@@ -274,8 +274,13 @@ func GenericJSONResponseWithMessage(code int, err error) events.APIGatewayProxyR
var body map[string]string
if err != nil {
customErr := err.(*errors.CustomError)
var message string
if customErr, ok := err.(*errors.CustomError); ok {
message = customErr.Formatted(errors.FormattingOptions{NewLines: false, Causes: true})
} else {
message = err.Error()
}
body = map[string]string{
"message": string_utils.Capitalize(message),
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment