Skip to content

Commit

Permalink
display more user friendly errors
Browse files Browse the repository at this point in the history
  • Loading branch information
umran committed Oct 24, 2024
1 parent 36402de commit 05702c3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion model/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ impl Error {

impl Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(&format!("{:?}", self))
let msg = match self {
Self::BadRequest(d)
| Self::InternalError(d)
| Self::NotFound(d)
| Self::Unauthorized(d) => d.message.as_str(),
};

f.write_str(&format!("{}", msg))
}
}

Expand Down

0 comments on commit 05702c3

Please sign in to comment.