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. /// Implementation-specific error.
CustomError, CustomError,
// I/O error
#[cfg(feature = "hostenv")]
IOError,
} }
#[cfg(feature = "hostenv")] #[cfg(feature = "std")]
#[allow(unused_variables)]
impl From<std::io::Error> for StorageError { impl From<std::io::Error> for StorageError {
fn from(error: std::io::Error) -> Self { fn from(_: std::io::Error) -> Self {
Self::IOError Self::CustomError
} }
} }

View File

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