diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-07-09 04:00:32 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-07-09 04:00:32 -0400 |
commit | 2c5f3df47d2737a823a13e44c330cbb138d05aa7 (patch) | |
tree | 07e0aaa804dd824ff57a4bc2a6120ea52dbb10d7 /src/tui.rs | |
parent | 9667d37c9043d23def44a236b305b865118c381e (diff) | |
download | nbsh-old-2c5f3df47d2737a823a13e44c330cbb138d05aa7.tar.gz nbsh-old-2c5f3df47d2737a823a13e44c330cbb138d05aa7.zip |
fix handling of errors from eval
Diffstat (limited to 'src/tui.rs')
-rw-r--r-- | src/tui.rs | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -8,8 +8,8 @@ pub enum Error { #[snafu(display("error during read: {}", source))] Read { source: crate::readline::Error }, - #[snafu(display("error during eval: {}", source))] - Eval { source: crate::eval::Error }, + #[snafu(display("error from state: {}", source))] + State { source: crate::state::Error }, #[snafu(display("error during sending: {}", source))] Sending { @@ -41,14 +41,14 @@ pub fn tui() { }) .then(move |res| match res { // successful run or empty input means prompt again - Ok(_) - | Err(Error::Eval { + Ok(Ok(())) + | Ok(Err(crate::state::Error::Eval { source: crate::eval::Error::Parser { source: crate::parser::Error::CommandRequired, .. }, - }) => Ok(futures::future::Loop::Continue(idx + 1)), + })) => Ok(futures::future::Loop::Continue(idx + 1)), // eof means we're done Err(Error::Read { source: crate::readline::Error::EOF, @@ -59,6 +59,10 @@ pub fn tui() { error(&e); Ok(futures::future::Loop::Continue(idx + 1)) } + Ok(Err(e)) => { + error(&Error::State { source: e }); + Ok(futures::future::Loop::Continue(idx + 1)) + } }) }) })); |