Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support NATS error codes for JetStream interactions #11

Open
9 of 12 tasks
ripienaar opened this issue Jul 6, 2021 · 1 comment
Open
9 of 12 tasks

Support NATS error codes for JetStream interactions #11

ripienaar opened this issue Jul 6, 2021 · 1 comment
Assignees
Labels
client Client related work enhancement New feature or request server:2.3.x

Comments

@ripienaar
Copy link
Contributor

ripienaar commented Jul 6, 2021

Overview

Prefer NATS error codes when conditionally handling JetStream API errors and expose the code to users.

The basic idea is that in the past we would return errors like replicas > 1 not supported in non-clustered mode in the ApiErr and clients would parse these messages if they wanted to handle different errors differently.

Another case would be when accessing a consumer, you'd get a error like 404 but you would not know if this is due to a stream being missing or a consumer being missing.

We now have codes in addition to the errors, the replicas > 1 not supported in non-clustered mode has code 10074, libraries should check this code rather than parse the text. The error text is not part of the API promises and we need to be able to make changes to language, typos, etc.

The cli has nats error lookup 10074 to compliment these.

The behavior is documented in ADR-7, initial server PR nats-io/nats-server#2168

Clients and Tools

Other Tasks

Client authors please update with your progress. If you open issues in your own repositories as a result of this request, please link them to this one by pasting the issue URL in a comment or main issue description.

@ripienaar ripienaar added enhancement New feature or request client Client related work labels Jul 6, 2021
@ripienaar ripienaar changed the title Support Support NATS error codes for JetStream interactions Jul 6, 2021
@scottf scottf removed their assignment Feb 17, 2022
@piotrpio piotrpio removed their assignment Aug 25, 2022
@wallyqs
Copy link
Member

wallyqs commented Aug 25, 2022

Following releases of the Go client use errors wrapping for JetStream errors to capture APIError details: nats-io/nats.go#1047

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Client related work enhancement New feature or request server:2.3.x
Projects
None yet
Development

No branches or pull requests

10 participants