Skip to content

implement std::error::Error for RedisError and cleanup - #467

Open
JonasKruckenberg wants to merge 1 commit into
masterfrom
push-ysqyrtooqwlk
Open

implement std::error::Error for RedisError and cleanup#467
JonasKruckenberg wants to merge 1 commit into
masterfrom
push-ysqyrtooqwlk

Conversation

@JonasKruckenberg

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the crate’s internal error handling by making RedisError implement std::error::Error, centralizing string rendering via a new to_str() helper, and introducing typed variants for specific conversion failures (NUL / UTF-8).

Changes:

  • Implement fmt::Display + std::error::Error for RedisError, and add RedisError::to_str() for consistent error formatting.
  • Add new RedisError variants for NulError and Utf8Error, and wire them into existing call sites (e.g., hash_get_multi).
  • Simplify Context::reply error handling to a single Err(err) branch using to_str().

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/rediserror.rs Adds Error impl, to_str(), and new error variants; changes conversion behavior.
src/raw.rs Maps CString::new NUL failures into a new RedisError variant.
src/context/mod.rs Simplifies replying with errors by formatting all RedisErrors via to_str().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/rediserror.rs
Comment thread src/rediserror.rs
Comment thread src/rediserror.rs Outdated

@kei-nan kei-nan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Asked copilot to review
@JonasKruckenberg can you take a look at the comments it left?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants