Skip to content

Commit

Permalink
Print error kind too
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo committed Apr 3, 2022
1 parent f972974 commit 6656f45
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions common/exception/src/exception_into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,12 @@ impl From<std::io::Error> for ErrorCode {
fn from(error: std::io::Error) -> Self {
use std::io::ErrorKind;

let msg = format!("{} ({})", error.kind(), &error);

match error.kind() {
ErrorKind::NotFound => ErrorCode::StorageNotFound(error.to_string()),
ErrorKind::PermissionDenied => ErrorCode::StoragePermissionDenied(error.to_string()),
_ => ErrorCode::StorageOther(error.to_string()),
ErrorKind::NotFound => ErrorCode::StorageNotFound(msg),
ErrorKind::PermissionDenied => ErrorCode::StoragePermissionDenied(msg),
_ => ErrorCode::StorageOther(msg),
}
}
}
Expand Down

0 comments on commit 6656f45

Please sign in to comment.