Skip to content

Commit

Permalink
js: change to use errors.Is
Browse files Browse the repository at this point in the history
Signed-off-by: Waldemar Quevedo <wally@nats.io>
  • Loading branch information
wallyqs committed Aug 22, 2022
1 parent aad6326 commit a89ee00
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions jsm.go
Expand Up @@ -327,10 +327,9 @@ func (js *js) AccountInfo(opts ...JSOpt) (*AccountInfo, error) {
return nil, err
}
if info.Error != nil {
// Check based on error code instead of description match.
if info.Error.ErrorCode == JSErrCodeJetStreamNotEnabledForAccount {
err = ErrJetStreamNotEnabledForAccount
} else if info.Error.ErrorCode == JSErrCodeJetStreamNotEnabled {
var err error
// Internally checks based on error code instead of description match.
if errors.Is(info.Error, ErrJetStreamNotEnabledForAccount) {
err = ErrJetStreamNotEnabled
} else {
err = &jsAPIError{
Expand Down

0 comments on commit a89ee00

Please sign in to comment.