Skip to content

Commit

Permalink
refactor(middleware): switch type usage
Browse files Browse the repository at this point in the history
  • Loading branch information
adhocore committed Apr 24, 2021
1 parent 6461a6b commit 624659e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions middleware/recover.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ func Recover(next http.Handler) http.Handler {
defer func() {
err := common.ErrServerError
if rec := recover(); rec != nil {
switch rec.(type) {
switch typ := rec.(type) {
case error:
err = rec.(error)
err = typ
}

response.JSON(res, http.StatusInternalServerError, response.Body{"message": err.Error()})
Expand Down

0 comments on commit 624659e

Please sign in to comment.