Use StorageError::CustomError for implementations-specific (I/O) errors

This commit is contained in:
Egor Duda
2022-06-05 22:39:13 +03:00
parent 1cf7373bfe
commit f2cb2f72e7
2 changed files with 3 additions and 10 deletions

View File

@@ -34,17 +34,12 @@ pub enum StorageError {
/// Implementation-specific error.
CustomError,
// I/O error
#[cfg(feature = "hostenv")]
IOError,
}
#[cfg(feature = "hostenv")]
#[allow(unused_variables)]
#[cfg(feature = "std")]
impl From<std::io::Error> for StorageError {
fn from(error: std::io::Error) -> Self {
Self::IOError
fn from(_: std::io::Error) -> Self {
Self::CustomError
}
}

View File

@@ -72,8 +72,6 @@ impl From<StorageError> for StoreError {
fn from(error: StorageError) -> StoreError {
match error {
StorageError::CustomError => StoreError::StorageError,
#[cfg(feature = "hostenv")]
StorageError::IOError => StoreError::StorageError,
// The store always calls the storage correctly.
StorageError::NotAligned | StorageError::OutOfBounds => unreachable!(),
}