-
Notifications
You must be signed in to change notification settings - Fork 23
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Summary
There is a misspelled enum variant in ResponseCode within the rabbitmq-stream-client Rust crate.
The variant is currently named:
ResponseCode::PrecoditionFailedThis is a typo and should be:
ResponseCode::PreconditionFailedAlthough the numeric mapping is correct (RESPONSE_CODE_PRECONDITION_FAILED), the enum variant name itself is incorrect
Impact
- Developers must use an incorrect spelling (
PrecoditionFailed) when matching response codes. - Causes confusion when debugging and reading code.
- Mismatched variant name breaks common naming conventions and is inconsistent with AMQP/RabbitMQ terminology.
Proposed Fix
Rename the enum variant and update all match arms accordingly:
- ResponseCode::PrecoditionFailed
+ ResponseCode::PreconditionFailedAnd update both the TryFrom<u16> and From<&ResponseCode> implementations:
- RESPONSE_CODE_PRECONDITION_FAILED => Ok(ResponseCode::PrecoditionFailed),
+ RESPONSE_CODE_PRECONDITION_FAILED => Ok(ResponseCode::PreconditionFailed),- ResponseCode::PrecoditionFailed => RESPONSE_CODE_PRECONDITION_FAILED,
+ ResponseCode::PreconditionFailed => RESPONSE_CODE_PRECONDITION_FAILED,Reproduction steps
- Create or interact with a RabbitMQ Stream and cause a
RESPONSE_CODE_PRECONDITION_FAILEDresponse. - Observe how the client maps the numeric code using
TryFrom<u16>forResponseCode. - Inspect the resulting enum variant returned by the library.
- You will see the misspelled variant
ResponseCode::PrecoditionFailedinstead of the expectedResponseCode::PreconditionFailed. - Attempt to match on this variant in your own code.
- Notice that you must use the misspelled identifier, causing confusing or inconsistent code.
Expected behavior
- The library should expose the correctly spelled enum variant
ResponseCode::PreconditionFailed. - All conversions (
TryFrom<u16>andFrom<&ResponseCode>) should map to and from this correct variant. - Developers should be able to match errors using the correct and conventional spelling.
- Log outputs and error messages should report
PreconditionFailed, notPrecoditionFailed.
Additional context
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working