mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-09 05:58:55 +00:00
op_store: make OpStoreError::Other preserve source error object
This is the OpStore version of e1e75daa8e
.
This commit is contained in:
parent
60d48c27f6
commit
769426f99a
2 changed files with 5 additions and 5 deletions
|
@ -380,8 +380,8 @@ content_hash! {
|
|||
pub enum OpStoreError {
|
||||
#[error("Operation not found")]
|
||||
NotFound,
|
||||
#[error("{0}")]
|
||||
Other(String),
|
||||
#[error(transparent)]
|
||||
Other(Box<dyn std::error::Error + Send + Sync>),
|
||||
}
|
||||
|
||||
pub type OpStoreResult<T> = Result<T, OpStoreError>;
|
||||
|
|
|
@ -32,19 +32,19 @@ use crate::op_store::{
|
|||
|
||||
impl From<std::io::Error> for OpStoreError {
|
||||
fn from(err: std::io::Error) -> Self {
|
||||
OpStoreError::Other(err.to_string())
|
||||
OpStoreError::Other(err.into())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<PersistError> for OpStoreError {
|
||||
fn from(err: PersistError) -> Self {
|
||||
OpStoreError::Other(err.to_string())
|
||||
OpStoreError::Other(err.into())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<prost::DecodeError> for OpStoreError {
|
||||
fn from(err: prost::DecodeError) -> Self {
|
||||
OpStoreError::Other(err.to_string())
|
||||
OpStoreError::Other(err.into())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue