notify: Return detailed err msg when connecting to target fails (#16118)

This commit is contained in:
Anis Elleuch 2022-11-24 16:59:19 +01:00 committed by GitHub
parent 59f877fc64
commit 97eb7dbf5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,6 +22,7 @@ import (
"crypto/tls" "crypto/tls"
"crypto/x509" "crypto/x509"
"errors" "errors"
"fmt"
"net/http" "net/http"
"strconv" "strconv"
"strings" "strings"
@ -59,8 +60,11 @@ func TestSubSysNotificationTargets(ctx context.Context, cfg config.Config, subSy
for _, target := range targetList { for _, target := range targetList {
yes, err := target.IsActive() yes, err := target.IsActive()
if err != nil || !yes { if err == nil && !yes {
return ErrTargetsOffline err = ErrTargetsOffline
}
if err != nil {
return fmt.Errorf("error (%s): %w", target.ID(), err)
} }
} }