Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/data_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static MY_REDIS_TYPE: RedisType = RedisType::new(
);

unsafe extern "C" fn free(value: *mut c_void) {
Box::from_raw(value.cast::<MyType>());
drop(Box::from_raw(value.cast::<MyType>()));
}

fn alloc_set(ctx: &Context, args: Vec<RedisString>) -> RedisResult {
Expand Down
4 changes: 2 additions & 2 deletions src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ where
/// let hm = ctx
/// .open_key(keyname)
/// .hash_get_multi(fields)?
/// .ok_or(RedisError::Str("ERR key not found"))?;
/// .ok_or(RedisError::Str("key not found"))?;
/// let response: HashMap<&str, String> = hm.into_iter().collect();
/// ```
///
Expand All @@ -422,7 +422,7 @@ where
/// let hm = ctx
/// .open_key(keyname)
/// .hash_get_multi(fields)?
/// .ok_or(RedisError::Str("ERR key not found"))?;
/// .ok_or(RedisError::Str("key not found"))?;
/// let response: Vec<String> = hm.into_iter().map(|(_, v)| v).collect();
/// ```
///
Expand Down
2 changes: 1 addition & 1 deletion src/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ where

match res {
Status::Ok => Ok(()),
Status::Err => Err(RedisError::Str("ERR key is not a hash value")),
Status::Err => Err(RedisError::Str("key is not a hash value")),
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/rediserror.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ pub enum RedisError {
impl RedisError {
#[must_use]
pub fn nonexistent_key() -> Self {
Self::Str("ERR could not perform this operation on a key that doesn't exist")
Self::Str("could not perform this operation on a key that doesn't exist")
}

#[must_use]
pub fn short_read() -> Self {
Self::Str("ERR short read or OOM loading DB")
Self::Str("short read or OOM loading DB")
}
}

impl<T: std::error::Error> From<T> for RedisError {
fn from(e: T) -> Self {
Self::String(format!("ERR {}", e))
Self::String(e.to_string())
}
}

Expand All @@ -45,6 +45,6 @@ impl fmt::Display for RedisError {
RedisError::String(s) => s.as_str(),
};

write!(f, "{}", d)
write!(f, "ERR {d}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Breaks test error::tests::test_to_redis_error

}
}