Skip to content

Commit

Permalink
fix: keep context deadline exceeded as last
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Feb 22, 2023
1 parent 36097b2 commit 6345364
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gateway/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,12 +572,12 @@ func webError(w http.ResponseWriter, message string, err error, defaultCode int)
webErrorWithCode(w, message, err, http.StatusNotFound)
} else if ipld.IsNotFound(err) {
webErrorWithCode(w, message, err, http.StatusNotFound)
} else if errors.Is(err, context.DeadlineExceeded) || err == context.DeadlineExceeded {
webErrorWithCode(w, message, err, http.StatusRequestTimeout)
} else if errors.Is(err, ErrGatewayTimeout) {
webErrorWithCode(w, message, err, http.StatusGatewayTimeout)
} else if errors.Is(err, ErrBadGateway) {
webErrorWithCode(w, message, err, http.StatusBadGateway)
} else if errors.Is(err, context.DeadlineExceeded) || err == context.DeadlineExceeded {
webErrorWithCode(w, message, err, http.StatusRequestTimeout)
} else {
webErrorWithCode(w, message, err, defaultCode)
}
Expand Down

0 comments on commit 6345364

Please sign in to comment.