Skip to content

Commit

Permalink
fix: update comment and use better error matching scheme (#2041)
Browse files Browse the repository at this point in the history
applying feedback from: #2019
  • Loading branch information
jonathanj-square committed Jul 23, 2024
1 parent c3c7aa6 commit a2923d1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/rpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/http"
"os"
"strings"
"syscall"
"time"

"connectrpc.com/connect"
Expand Down Expand Up @@ -295,10 +296,9 @@ func RetryStreamingServerStream[Req, Resp any](
}
}

// useDebugErrorLevel indicates whether the specified error should be reported as a debug
// level log.
// logLevelForError indicates the log.Level to use for the specified error
func logLevelForError(err error) log.Level {
if err != nil && strings.Contains(err.Error(), "connect: connection refused") {
if err != nil && errors.Is(err, syscall.ECONNREFUSED) {
return log.Debug
}
return log.Warn
Expand Down

0 comments on commit a2923d1

Please sign in to comment.