From a2923d1eb3aa27811ad6b9e04f00c1ac31408881 Mon Sep 17 00:00:00 2001 From: Jon Johnson <113393155+jonathanj-square@users.noreply.github.com> Date: Tue, 23 Jul 2024 15:30:49 -0700 Subject: [PATCH] fix: update comment and use better error matching scheme (#2041) applying feedback from: https://github.com/TBD54566975/ftl/pull/2019 --- internal/rpc/rpc.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/rpc/rpc.go b/internal/rpc/rpc.go index fdba30505b..445fdcefc9 100644 --- a/internal/rpc/rpc.go +++ b/internal/rpc/rpc.go @@ -9,6 +9,7 @@ import ( "net/http" "os" "strings" + "syscall" "time" "connectrpc.com/connect" @@ -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