From 3bdb92fcadb6bf957ccc55290e4f19da64bb0056 Mon Sep 17 00:00:00 2001 From: Ray <18078751+rayjanoka@users.noreply.github.com> Date: Fri, 8 Jul 2022 00:14:47 -0600 Subject: [PATCH] Adding error check for jetstream connection (#15252) --- internal/event/target/nats.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/event/target/nats.go b/internal/event/target/nats.go index 684ad110d..441b1d0b8 100644 --- a/internal/event/target/nats.go +++ b/internal/event/target/nats.go @@ -256,10 +256,12 @@ func (target *NATSTarget) IsActive() (bool, error) { if target.natsConn != nil && target.args.JetStream.Enable { target.jstream, connErr = target.natsConn.JetStream() - if connErr.Error() == nats.ErrNoServers.Error() { - return false, errNotConnected + if connErr != nil { + if connErr.Error() == nats.ErrNoServers.Error() { + return false, errNotConnected + } + return false, connErr } - return false, connErr } return true, nil