Skip to content

Commit

Permalink
fix: don't log error if api request was cancelled
Browse files Browse the repository at this point in the history
See: BEDS-605
  • Loading branch information
LuccaBitfly committed Oct 17, 2024
1 parent 162a5f4 commit 7a50687
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions backend/pkg/api/handlers/handler_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,11 @@ func handleErr(w http.ResponseWriter, r *http.Request, err error) {
returnTooManyRequests(w, r, err)
case errors.Is(err, errGone):
returnGone(w, r, err)
case errors.Is(err, context.Canceled):
if r.Context().Err() != context.Canceled { // only return error if the request context was canceled
logApiError(r, err, 1)
returnError(w, r, http.StatusInternalServerError, err)
}
default:
logApiError(r, err, 1)
// TODO: don't return the error message to the user in production
Expand Down

0 comments on commit 7a50687

Please sign in to comment.