Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 10 additions & 2 deletions internal/standup-bot/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,18 @@ async fn main() {
}

if let Err(e) = redis::client::set_last_standup(Utc::now()).await {
eprintln!("Failed to save standup to Redis: {e:#?}");
eprintln!("Failed to save standup to Redis");
eprintln!("Error: {}", e);
eprintln!("Debug: {:#?}", e);
}
}
Err(e) => eprintln!("Failed to get last standup from Redis: {e:#?}"),
Err(e) => {
eprintln!("===============================================");
eprintln!("Failed to get last standup from Redis");
eprintln!("Error: {}", e);
eprintln!("Debug: {:#?}", e);
eprintln!("===============================================");
}
}
});
}
Expand Down
32 changes: 32 additions & 0 deletions internal/standup-bot/src/redis/error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use chrono::ParseError;
use redis::RedisError;
use std::fmt;

#[derive(Debug)]
#[allow(dead_code)]
Expand All @@ -8,6 +9,37 @@ pub enum RedisClientError {
DateTimeParse(ParseError),
}

impl fmt::Display for RedisClientError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
RedisClientError::Redis(e) => {
write!(f, "RedisError: {:?}", e)?;
write!(f, "\n Category: {:?}", e.category())?;
write!(f, "\n Kind: {:?}", e.kind())?;
write!(
f,
"\n is_connection_dropped: {}",
e.is_connection_dropped()
)?;
write!(f, "\n is_timeout: {}", e.is_timeout())?;
write!(
f,
"\n is_connection_refusal: {}",
e.is_connection_refusal()
)?;
write!(f, "\n is_io_error: {}", e.is_io_error())?;
if let Some(detail) = e.detail() {
write!(f, "\n Detail: {}", detail)?;
}
Ok(())
}
RedisClientError::DateTimeParse(e) => write!(f, "DateTimeParse: {:?}", e),
}
}
}

impl std::error::Error for RedisClientError {}

impl From<RedisError> for RedisClientError {
fn from(value: RedisError) -> Self {
RedisClientError::Redis(value)
Expand Down