Skip to content

Commit

Permalink
Add NOTBUSY error code.
Browse files Browse the repository at this point in the history
  • Loading branch information
nihohit committed Jul 17, 2023
1 parent 8c75912 commit 234202e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions redis/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ where
"CROSSSLOT" => ErrorKind::CrossSlot,
"MASTERDOWN" => ErrorKind::MasterDown,
"READONLY" => ErrorKind::ReadOnly,
"NOTBUSY" => ErrorKind::NotBusy,
code => return make_extension_error(code, pieces.next()),
};
match pieces.next() {
Expand Down
5 changes: 5 additions & 0 deletions redis/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ pub enum ErrorKind {
ExtensionError,
/// Attempt to write to a read-only server
ReadOnly,
/// Attempted to kill a script/function while they werent' executing
NotBusy,

#[cfg(feature = "json")]
/// Error Serializing a struct to JSON form
Expand Down Expand Up @@ -462,6 +464,7 @@ impl RedisError {
ErrorKind::CrossSlot => Some("CROSSSLOT"),
ErrorKind::MasterDown => Some("MASTERDOWN"),
ErrorKind::ReadOnly => Some("READONLY"),
ErrorKind::NotBusy => Some("NOTBUSY"),
_ => match self.repr {
ErrorRepr::ExtensionError(ref code, _) => Some(code),
_ => None,
Expand Down Expand Up @@ -489,6 +492,7 @@ impl RedisError {
ErrorKind::ExtensionError => "extension error",
ErrorKind::ClientError => "client error",
ErrorKind::ReadOnly => "read-only",
ErrorKind::NotBusy => "not busy",
#[cfg(feature = "json")]
ErrorKind::Serialize => "serializing",
}
Expand Down Expand Up @@ -636,6 +640,7 @@ impl RedisError {
ErrorKind::InvalidClientConfig => false,
ErrorKind::CrossSlot => false,
ErrorKind::ClientError => false,
ErrorKind::NotBusy => false,
#[cfg(feature = "json")]
ErrorKind::Serialize => false,
}
Expand Down

0 comments on commit 234202e

Please sign in to comment.