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

Symbolic constants for nats-server API error codes #1025

Open
davidmcote opened this issue Oct 26, 2023 · 0 comments
Open

Symbolic constants for nats-server API error codes #1025

davidmcote opened this issue Oct 26, 2023 · 0 comments
Labels
proposal Enhancement idea or proposal

Comments

@davidmcote
Copy link
Contributor

davidmcote commented Oct 26, 2023

Background

The nats-server package maintains a list of possible error codes at https://github.com/nats-io/nats-server/blob/main/server/errors.json.

The elements of this JSON listing appear to be ErrorsData structures which feed a code generator to produce go-native symbolic constants at https://github.com/nats-io/nats-server/blob/main/server/jetstream_errors_generated.go.

In NATS client packages however, there doesn't seem to be a complete list of error codes that may be returned from nats-server.

Without these constants, clients interested in detecting specific server-side error conditions must hard-code a subset of errors.json into their application.

Proposed change

Generate symbolic constants for NATS client libraries from the NATS server errors listing at error codes at https://github.com/nats-io/nats-server/blob/main/server/errors.json

Use case

Clients interested in detecting specific server-side error conditions can match error codes by named symbolic constants without first duplicating the information in https://github.com/nats-io/nats-server/blob/main/server/errors.json.

@davidmcote davidmcote added the proposal Enhancement idea or proposal label Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Enhancement idea or proposal
Projects
None yet
Development

No branches or pull requests

1 participant