diff options
Diffstat (limited to 'tvix/castore/src/errors.rs')
-rw-r--r-- | tvix/castore/src/errors.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tvix/castore/src/errors.rs b/tvix/castore/src/errors.rs index 4c164029aeec..1b3ae4d1c862 100644 --- a/tvix/castore/src/errors.rs +++ b/tvix/castore/src/errors.rs @@ -40,6 +40,16 @@ impl From<crate::tonic::Error> for Error { } } +impl From<std::io::Error> for Error { + fn from(value: std::io::Error) -> Self { + if value.kind() == std::io::ErrorKind::InvalidInput { + Error::InvalidRequest(value.to_string()) + } else { + Error::StorageError(value.to_string()) + } + } +} + // TODO: this should probably go somewhere else? impl From<Error> for std::io::Error { fn from(value: Error) -> Self { |