so many error cases.

This commit is contained in:
2023-04-21 20:23:20 -07:00
parent 7596472c65
commit d0a0fdacfe

View File

@@ -16,18 +16,30 @@ fn main() -> Result<(), BackendError> {
":quit" => break, ":quit" => break,
_ => state.process_input(line_no, command), _ => state.process_input(line_no, command),
}, },
// it's not clear to me what this could be, but OK
Err(ReadlineError::Io(e)) => { Err(ReadlineError::Io(e)) => {
eprintln!("IO error: {}", e); eprintln!("IO error: {}", e);
break; break;
} }
// Control-D and Control-C
Err(ReadlineError::Eof) => break, Err(ReadlineError::Eof) => break,
Err(ReadlineError::Interrupted) => break, Err(ReadlineError::Interrupted) => break,
// For some reason this doesn't exist on Windows. I also don't quite know
// what would cause this, but ...
#[cfg(not(windows))] #[cfg(not(windows))]
Err(ReadlineError::Errno(e)) => { Err(ReadlineError::Errno(e)) => {
eprintln!("Unknown syscall error: {}", e); eprintln!("Unknown syscall error: {}", e);
break; break;
} }
// We don't actually do any reflow-ing if we change the terminal size,
// so we can just ignore this.
Err(ReadlineError::WindowResized) => continue, Err(ReadlineError::WindowResized) => continue,
// Why on earth are there so many error types?
Err(e) => { Err(e) => {
eprintln!("Unknown internal error: {}", e); eprintln!("Unknown internal error: {}", e);
break; break;