diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-12-14 18:19:27 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-12-14 18:19:27 -0500 |
commit | a50aafc38b07359bd4c7bf88f118cdbcdd561790 (patch) | |
tree | f7e0973406af33393c97cf1bdf51337c6e3a0828 /src | |
parent | 02f66d1819293f13a90c38e4b1c704f07fc4dd26 (diff) | |
download | ttyrec-a50aafc38b07359bd4c7bf88f118cdbcdd561790.tar.gz ttyrec-a50aafc38b07359bd4c7bf88f118cdbcdd561790.zip |
add source data for errors
Diffstat (limited to 'src')
-rw-r--r-- | src/error.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/error.rs b/src/error.rs index 5442068..b682e9d 100644 --- a/src/error.rs +++ b/src/error.rs @@ -47,6 +47,13 @@ impl std::fmt::Display for Error { } } -impl std::error::Error for Error {} +impl std::error::Error for Error { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + Self::Read { source } | Self::Write { source } => Some(source), + _ => None, + } + } +} pub type Result<T> = std::result::Result<T, Error>; |