Skip to content

Commit

Permalink
fix(bendsql): fmt of error. (#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
youngsofun authored Nov 26, 2024
1 parent a37b16e commit e4f38c1
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions core/src/error_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,11 @@ pub struct ResponseWithErrorCode {

impl Display for ErrorCode {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(
f,
"[{}]{}.{}",
self.code,
self.message,
self.detail.clone().unwrap_or("".to_string())
)
match &self.detail {
Some(d) if !d.is_empty() => {
write!(f, "[{}]{}\n{}", self.code, self.message, d)
}
_ => write!(f, "[{}]{}", self.code, self.message,),
}
}
}

0 comments on commit e4f38c1

Please sign in to comment.