Add StorageBackendError::caused_by member

This commit is contained in:
Matthias Beyer 2015-12-02 11:39:50 +01:00
parent c73cb88df4
commit 8ff5dcc9e8
1 changed files with 4 additions and 2 deletions

View File

@ -164,7 +164,8 @@ impl StorageBackend {
pub struct StorageBackendError {
pub action: String, // The file system action in words
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 {
@ -176,6 +177,7 @@ impl StorageBackendError {
action: action,
desc: desc,
data_dump: data,
caused_by: None,
}
}
}
@ -187,7 +189,7 @@ impl Error for StorageBackendError {
}
fn cause(&self) -> Option<&Error> {
None
self.caused_by.as_ref().map(|e| &**e)
}
}