diff options
author | Irene Knapp <ireneista@gmail.com> | 2021-03-11 20:15:47 -0800 |
---|---|---|
committer | Irene Knapp <ireneista@gmail.com> | 2021-03-11 20:15:47 -0800 |
commit | 86990efcf8fa63decb05f462d745b95e4992dc77 (patch) | |
tree | 46990fd1c749ccca0b6477650973d83174e5e264 /src/terminal/error.rs | |
parent | a159d4dd29491a1eb88163e63ceb41a903dc47b6 (diff) |
refactor everything into smaller modules; move to using async-std; make the read loop async. some stuff doesn't work yet but it needed to be done and this is as clean a state as it's likely to get in, so we're committing it as a base to build on.
Diffstat (limited to 'src/terminal/error.rs')
-rw-r--r-- | src/terminal/error.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/terminal/error.rs b/src/terminal/error.rs index 6666e49..795f973 100644 --- a/src/terminal/error.rs +++ b/src/terminal/error.rs @@ -1,7 +1,13 @@ +#![forbid(unsafe_code)] + +pub type Result<T> = std::result::Result<T, TerminalError>; + + #[derive(Clone,Debug,Eq,Hash,Ord,PartialEq,PartialOrd)] pub enum TerminalError { Input(String), ModeSetting(String), + Internal(String), } impl std::error::Error for TerminalError { } @@ -15,6 +21,9 @@ impl std::fmt::Display for TerminalError { TerminalError::ModeSetting(s) => f.write_fmt(format_args!( "Can't set terminal mode: {}", s)), + TerminalError::Internal(s) => + f.write_fmt(format_args!( + "Internal error regarding the terminal: {}", s)), } } } @@ -29,3 +38,8 @@ pub fn mode_setting(e: impl std::error::Error) -> TerminalError { TerminalError::ModeSetting(format!("{}", e)) } + +pub fn internal(e: impl std::error::Error) -> TerminalError { + TerminalError::Internal(format!("{}", e)) +} + |