diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-12-03 21:28:44 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-12-04 01:58:12 -0500 |
commit | 9d07ac10cf7ec1278dd90ae8c4fe73cbd80c3fd5 (patch) | |
tree | f13aa19d200087b392e6481da97fdeb30dfd3bae /src/error.rs | |
parent | 8a98d4fee2172d5ac53e74bcc95cd39aa68492a3 (diff) | |
download | ttyrec-9d07ac10cf7ec1278dd90ae8c4fe73cbd80c3fd5.tar.gz ttyrec-9d07ac10cf7ec1278dd90ae8c4fe73cbd80c3fd5.zip |
reintroduce readers and writers with a new api
Diffstat (limited to 'src/error.rs')
-rw-r--r-- | src/error.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs index 9ca35a8..6978990 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,6 +1,9 @@ /// Errors potentially returned by this crate. #[derive(Debug)] pub enum Error { + /// eof + EOF, + /// failed to create ttyrec frame: got N bytes of data but ttyrec frames /// can be at most M bytes FrameTooBig { input: usize }, @@ -8,13 +11,22 @@ pub enum Error { /// failed to create ttyrec frame: got N seconds but ttyrec frames can be /// at most M seconds FrameTooLong { input: u64 }, + + /// failed to read from input + Read { source: std::io::Error }, + + /// failed to write to output + Write { source: std::io::Error }, } impl std::fmt::Display for Error { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { + Self::EOF => write!(f, "eof"), Self::FrameTooBig { input } => write!(f, "failed to create ttyrec frame: got {} bytes of data, but ttyrec frames can be at most {} bytes", input, u32::max_value()), Self::FrameTooLong { input } => write!(f, "failed to create ttyrec frame: got {} seconds, but ttyrecs can be at most {} seconds", input, u32::max_value()), + Self::Read { source } => write!(f, "failed to read from input: {}", source), + Self::Write { source } => write!(f, "failed to write to output: {}", source), } } } |