fix: return on errors
This commit is contained in:
parent
114c7101d6
commit
a3ee0b7900
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user