Skip to content

Commit

Permalink
re: extract logging operation outside switch block
Browse files Browse the repository at this point in the history
  • Loading branch information
cybardev committed Oct 28, 2024
1 parent 0a4f4a9 commit 9dc7823
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions resumake.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ func customHTTPErrorHandler(err error, c echo.Context) {
if he, ok := err.(*echo.HTTPError); ok {
code = he.Code
}
c.Logger().Error(err)
// server error by default
ep := ErrorPage{
code,
Expand All @@ -123,15 +124,13 @@ func customHTTPErrorHandler(err error, c echo.Context) {
// check for user error
switch e := err.(type) {
case *YAMLValidationError:
c.Logger().Error(e)
ep = ErrorPage{
422,
"YAML Validation Error",
e.Msg,
true,
}
default:
c.Logger().Error(e)
if 400 <= code && code < 500 {
ep = ErrorPage{
code,
Expand Down

0 comments on commit 9dc7823

Please sign in to comment.