From a3ee0b7900d9a38e877f7895e4f7af97ab66702b Mon Sep 17 00:00:00 2001 From: xuu Date: Sat, 7 Oct 2023 18:11:35 -0600 Subject: [PATCH] fix: return on errors --- app/peerfinder/http.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/peerfinder/http.go b/app/peerfinder/http.go index aed6f58..03c694b 100644 --- a/app/peerfinder/http.go +++ b/app/peerfinder/http.go @@ -206,6 +206,7 @@ func (s *service) getPending(w http.ResponseWriter, r *http.Request, peerID stri if err != nil && !errors.Is(err, ev.ErrNotFound) { span.RecordError(fmt.Errorf("peer not found: %w", err)) w.WriteHeader(http.StatusNotFound) + return } var req *Request @@ -223,6 +224,7 @@ func (s *service) getPending(w http.ResponseWriter, r *http.Request, peerID stri if req == nil { span.RecordError(fmt.Errorf("request not found")) w.WriteHeader(http.StatusNoContent) + return } negotiator := contentnegotiation.NewNegotiator("application/json", "text/environment", "text/plain", "text/html") @@ -451,6 +453,7 @@ func (s *service) postResult(w http.ResponseWriter, r *http.Request, reqID strin if err != nil { span.RecordError(fmt.Errorf("peer not found: %w", err)) w.WriteHeader(http.StatusNotFound) + return } if peerResults.Has(reqID) {