diff --git a/jsm.go b/jsm.go index 3bc3535cb..4c13e895e 100644 --- a/jsm.go +++ b/jsm.go @@ -304,8 +304,8 @@ func (js *js) AccountInfo(opts ...JSOpt) (*AccountInfo, error) { } if info.Error != nil { var err error - // Check based on error code instead of description match. - if info.Error.ErrorCode == ErrJetStreamNotEnabled.ErrorCode() { + // Internally checks based on error code instead of description match. + if errors.Is(info.Error, ErrJetStreamNotEnabled) { err = ErrJetStreamNotEnabled } else { err = &jsAPIError{