Skip to content

Commit

Permalink
Mark no such host error as downstream (#1089)
Browse files Browse the repository at this point in the history
  • Loading branch information
iwysiu authored Sep 17, 2024
1 parent 22ef5f5 commit 4110266
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions experimental/errorsource/error_source_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package errorsource

import (
"errors"
"net"
"net/http"
"syscall"

Expand All @@ -28,6 +29,10 @@ func RoundTripper(_ httpclient.Options, next http.RoundTripper) http.RoundTrippe
if errors.Is(err, syscall.ECONNREFUSED) {
return res, Error{source: backend.ErrorSourceDownstream, err: err}
}
var dnsError *net.DNSError
if errors.As(err, &dnsError) && dnsError.IsNotFound {
return res, Error{source: backend.ErrorSourceDownstream, err: err}
}
return res, err
})
}

0 comments on commit 4110266

Please sign in to comment.