Skip to content

Commit ab1e3fd

Browse files
committed
fixed typo for ResponseCode::PrecoditionFailed
- changed the enum variant for `ResponseCode::PrecoditionFailed` to `ResponseCode::PrecondtionFailed` - Updated conversions (TryFrom<u16> and From<&ResponseCode>) to map to and from this correct variant. - updated tests that implement this enum variant
1 parent 6a98283 commit ab1e3fd

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

protocol/src/response/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub enum ResponseCode {
4343
FrameTooLarge,
4444
InternalError,
4545
AccessRefused,
46-
PrecoditionFailed,
46+
PreconditionFailed,
4747
PublisherDoesNotExist,
4848
OffsetNotFound,
4949
}

protocol/src/response/shims.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl TryFrom<u16> for ResponseCode {
3232
RESPONSE_CODE_FRAME_TOO_LARGE => Ok(ResponseCode::FrameTooLarge),
3333
RESPONSE_CODE_INTERNAL_ERROR => Ok(ResponseCode::InternalError),
3434
RESPONSE_CODE_ACCESS_REFUSED => Ok(ResponseCode::AccessRefused),
35-
RESPONSE_CODE_PRECONDITION_FAILED => Ok(ResponseCode::PrecoditionFailed),
35+
RESPONSE_CODE_PRECONDITION_FAILED => Ok(ResponseCode::PreconditionFailed),
3636
RESPONSE_CODE_PUBLISHER_DOES_NOT_EXIST => Ok(ResponseCode::PublisherDoesNotExist),
3737
RESPONSE_CODE_OFFSET_NOT_FOUND => Ok(ResponseCode::OffsetNotFound),
3838
_ => Err(DecodeError::UnknownResponseCode(value)),
@@ -65,7 +65,7 @@ impl From<&ResponseCode> for u16 {
6565
ResponseCode::FrameTooLarge => RESPONSE_CODE_FRAME_TOO_LARGE,
6666
ResponseCode::InternalError => RESPONSE_CODE_INTERNAL_ERROR,
6767
ResponseCode::AccessRefused => RESPONSE_CODE_ACCESS_REFUSED,
68-
ResponseCode::PrecoditionFailed => RESPONSE_CODE_PRECONDITION_FAILED,
68+
ResponseCode::PreconditionFailed => RESPONSE_CODE_PRECONDITION_FAILED,
6969
ResponseCode::PublisherDoesNotExist => RESPONSE_CODE_PUBLISHER_DOES_NOT_EXIST,
7070
ResponseCode::OffsetNotFound => RESPONSE_CODE_OFFSET_NOT_FOUND,
7171
}

tests/client_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ async fn client_declare_delete_publisher_twice_error() {
295295
.await
296296
.unwrap();
297297

298-
assert_eq!(&ResponseCode::PrecoditionFailed, response_error.code());
298+
assert_eq!(&ResponseCode::PreconditionFailed, response_error.code());
299299

300300
let response = test.client.delete_publisher(1).await.unwrap();
301301
assert_eq!(&ResponseCode::Ok, response.code());

0 commit comments

Comments
 (0)