nats-io / nats-server

High-Performance server for NATS.io, the cloud and edge native messaging system.
https://nats.io
Apache License 2.0
15.49k stars 1.38k forks source link

Add unique identifier to api error responses #1975

Closed scottf closed 3 years ago

scottf commented 3 years ago

Feature Request

Add unique identifier to api error responses

Use Case:

When calling CONSUMER.INFO.%s.%s and an error is returned we have to check the string description to determine which was the problem, the stream or the consumer, since both errors are 404

io.nats.jetstream.api.v1.consumer_info_response 404 consumer not found
io.nats.jetstream.api.v1.consumer_info_response 404 stream not found

Proposed Change:

Add a field to the error object to hold a unique numeric code

Who Benefits From The Change(s)?

Clients can identify specific errors faster and without relying on string comparison.

ripienaar commented 3 years ago

My plan was to do this after GA as it’s an addition so would be safe.

Duplicate issue here https://github.com/nats-io/nats-server/issues/1811

scottf commented 3 years ago

Duplicate issue here #1811