From 97eb7dbf5fbe8662035bb06718c580ae275db2c4 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Thu, 24 Nov 2022 16:59:19 +0100 Subject: [PATCH] notify: Return detailed err msg when connecting to target fails (#16118) --- internal/config/notify/parse.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/config/notify/parse.go b/internal/config/notify/parse.go index be750f3f9..6230bb239 100644 --- a/internal/config/notify/parse.go +++ b/internal/config/notify/parse.go @@ -22,6 +22,7 @@ import ( "crypto/tls" "crypto/x509" "errors" + "fmt" "net/http" "strconv" "strings" @@ -59,8 +60,11 @@ func TestSubSysNotificationTargets(ctx context.Context, cfg config.Config, subSy for _, target := range targetList { yes, err := target.IsActive() - if err != nil || !yes { - return ErrTargetsOffline + if err == nil && !yes { + err = ErrTargetsOffline + } + if err != nil { + return fmt.Errorf("error (%s): %w", target.ID(), err) } }