fix: return on errors
All checks were successful
Go Bump / bump (push) Successful in 46s
Go Test / test (push) Successful in 52s
Deploy / deploy (push) Successful in 1m42s

This commit is contained in:
xuu 2023-10-07 18:11:35 -06:00
parent 114c7101d6
commit a3ee0b7900
Signed by: xuu
GPG Key ID: 8B3B0604F164E04F

View File

@ -206,6 +206,7 @@ func (s *service) getPending(w http.ResponseWriter, r *http.Request, peerID stri
if err != nil && !errors.Is(err, ev.ErrNotFound) { if err != nil && !errors.Is(err, ev.ErrNotFound) {
span.RecordError(fmt.Errorf("peer not found: %w", err)) span.RecordError(fmt.Errorf("peer not found: %w", err))
w.WriteHeader(http.StatusNotFound) w.WriteHeader(http.StatusNotFound)
return
} }
var req *Request var req *Request
@ -223,6 +224,7 @@ func (s *service) getPending(w http.ResponseWriter, r *http.Request, peerID stri
if req == nil { if req == nil {
span.RecordError(fmt.Errorf("request not found")) span.RecordError(fmt.Errorf("request not found"))
w.WriteHeader(http.StatusNoContent) w.WriteHeader(http.StatusNoContent)
return
} }
negotiator := contentnegotiation.NewNegotiator("application/json", "text/environment", "text/plain", "text/html") 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 { if err != nil {
span.RecordError(fmt.Errorf("peer not found: %w", err)) span.RecordError(fmt.Errorf("peer not found: %w", err))
w.WriteHeader(http.StatusNotFound) w.WriteHeader(http.StatusNotFound)
return
} }
if peerResults.Has(reqID) { if peerResults.Has(reqID) {