Skip to content

Commit

Permalink
Fix for account info errors
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Collison <derek@nats.io>
  • Loading branch information
derekcollison committed Jan 27, 2021
1 parent 58bf69a commit 605c52b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions jsm.go
Expand Up @@ -136,8 +136,14 @@ func (js *js) AccountInfo() (*AccountInfo, error) {
if err := json.Unmarshal(resp.Data, &info); err != nil {
return nil, err
}
if info.Error != nil && info.Error.Code == 503 {
return nil, ErrJetStreamNotEnabled
if info.Error != nil {
var err error
if strings.Contains(info.Error.Description, "not enabled for") {
err = ErrJetStreamNotEnabled
} else {
err = errors.New(info.Error.Description)
}
return nil, err
}

return &info.AccountInfo, nil
Expand Down

0 comments on commit 605c52b

Please sign in to comment.