Add StorageBackendError::caused_by member
This commit is contained in:
parent
c73cb88df4
commit
8ff5dcc9e8
1 changed files with 4 additions and 2 deletions
|
@ -164,7 +164,8 @@ impl StorageBackend {
|
||||||
pub struct StorageBackendError {
|
pub struct StorageBackendError {
|
||||||
pub action: String, // The file system action in words
|
pub action: String, // The file system action in words
|
||||||
pub desc: String, // A short description
|
pub desc: String, // A short description
|
||||||
pub data_dump: Option<String> // Data dump, if any
|
pub data_dump: Option<String>, // Data dump, if any
|
||||||
|
pub caused_by: Option<Box<Error>>, // caused from this error
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StorageBackendError {
|
impl StorageBackendError {
|
||||||
|
@ -176,6 +177,7 @@ impl StorageBackendError {
|
||||||
action: action,
|
action: action,
|
||||||
desc: desc,
|
desc: desc,
|
||||||
data_dump: data,
|
data_dump: data,
|
||||||
|
caused_by: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,7 +189,7 @@ impl Error for StorageBackendError {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cause(&self) -> Option<&Error> {
|
fn cause(&self) -> Option<&Error> {
|
||||||
None
|
self.caused_by.as_ref().map(|e| &**e)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue