diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-12-14 17:08:08 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-12-14 17:08:08 -0500 |
commit | 91ab8435b8145d46a1a88b5de8df619fb4664c33 (patch) | |
tree | baa09451991760551fb9f364773d57b7e632b961 | |
parent | b909e76e10695a869313c549753326d6831e2051 (diff) | |
download | textmode-91ab8435b8145d46a1a88b5de8df619fb4664c33.tar.gz textmode-91ab8435b8145d46a1a88b5de8df619fb4664c33.zip |
also implement source
-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 f87cead..fea92b6 100644 --- a/src/error.rs +++ b/src/error.rs @@ -27,7 +27,14 @@ 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::ReadStdin(e) | Self::WriteStdout(e) => Some(e), + Self::SetTerminalMode(e) => Some(e), + } + } +} /// Convenience wrapper for a `Result` using `textmode::Error`. pub type Result<T> = std::result::Result<T, Error>; |