diff options
author | Tim Oram <dev@mitmaro.ca> | 2020-09-17 10:45:49 -0230 |
---|---|---|
committer | Tim Oram <dev@mitmaro.ca> | 2020-09-17 22:01:14 -0230 |
commit | c6dbcc6017a7a1b343a585729239ad52ccb6ceba (patch) | |
tree | 5f27828bc435ef9eed85ebd835d55418985c07cb /src/confirm_rebase | |
parent | 10d797ebf3910f45f6ed3cd01573e531f388f31d (diff) |
Move error handling to process module
The error handling module needed to have state provided to it from other
modules, which meant that the other modules needed to understand how the
error module worked. This was awkward and fragile. This moves the error
handling code into the process module and makes it a global system. This
has the advantage of not requiring tracking of the previous state and
allows for the removal of the HandleInputResult struct.
Diffstat (limited to 'src/confirm_rebase')
-rw-r--r-- | src/confirm_rebase/mod.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/confirm_rebase/mod.rs b/src/confirm_rebase/mod.rs index 717f25d..b400fc9 100644 --- a/src/confirm_rebase/mod.rs +++ b/src/confirm_rebase/mod.rs @@ -2,8 +2,8 @@ use crate::git_interactive::GitInteractive; use crate::input::input_handler::{InputHandler, InputMode}; use crate::input::Input; use crate::process::exit_status::ExitStatus; -use crate::process::handle_input_result::{HandleInputResult, HandleInputResultBuilder}; use crate::process::process_module::ProcessModule; +use crate::process::process_result::ProcessResult; use crate::process::state::State; use crate::view::view_data::ViewData; use crate::view::View; @@ -25,10 +25,10 @@ impl ProcessModule for ConfirmRebase { input_handler: &InputHandler<'_>, _git_interactive: &mut GitInteractive, _view: &View<'_>, - ) -> HandleInputResult + ) -> ProcessResult { let input = input_handler.get_input(InputMode::Confirm); - let mut result = HandleInputResultBuilder::new(input); + let mut result = ProcessResult::new().input(input); match input { Input::Yes => { result = result.exit_status(ExitStatus::Good).state(State::Exiting); @@ -38,7 +38,7 @@ impl ProcessModule for ConfirmRebase { }, _ => {}, } - result.build() + result } } |