aboutsummaryrefslogtreecommitdiff
path: root/src/device
diff options
context:
space:
mode:
Diffstat (limited to 'src/device')
-rw-r--r--src/device/storage.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/device/storage.rs b/src/device/storage.rs
index deb2844..1e2c46d 100644
--- a/src/device/storage.rs
+++ b/src/device/storage.rs
@@ -678,7 +678,7 @@ impl<'a> Storage<'a> {
if usage_data.write_level_min > usage_data.write_level_max
|| usage_data.write_level_max > 100
{
- Err(Error::UnexpectedError)
+ Err(Error::UnexpectedError("Invalid write levels".to_owned()))
} else {
Ok(ops::Range {
start: usage_data.write_level_min,
@@ -708,10 +708,14 @@ impl<'a> Storage<'a> {
match status {
0..=100 => u8::try_from(status)
.map(OperationStatus::Ongoing)
- .map_err(|_| Error::UnexpectedError),
+ .map_err(|_| {
+ Error::UnexpectedError("Cannot create u8 from operation status".to_owned())
+ }),
-1 => Ok(OperationStatus::Idle),
-2 => Err(get_last_error()),
- _ => Err(Error::UnexpectedError),
+ _ => Err(Error::UnexpectedError(
+ "Invalid operation status".to_owned(),
+ )),
}
}