diff options
author | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-06-29 22:19:47 -0400 |
---|---|---|
committer | Jiayi Zhao <jeff.no.zhao@gmail.com> | 2019-06-29 22:23:31 -0400 |
commit | 65f0f33a564d91bd8126ce684c02f245e5ea9a1f (patch) | |
tree | bc9bb5d877cee131dc7870c5f9f5d0c71898efbd /src/commands/delete_files.rs | |
parent | 58f6428e2aead58b7f930008b294ce56df59e3cb (diff) |
rework error system
- JoshutoErrorKind now envelops all possible errors by Joshuto
- JoshutoError behaves like std::io::Error
- add JoshutoResult
Diffstat (limited to 'src/commands/delete_files.rs')
-rw-r--r-- | src/commands/delete_files.rs | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/commands/delete_files.rs b/src/commands/delete_files.rs index 045798f..ac66c9d 100644 --- a/src/commands/delete_files.rs +++ b/src/commands/delete_files.rs @@ -3,7 +3,7 @@ use std::path; use crate::commands::{JoshutoCommand, JoshutoRunnable, ReloadDirList}; use crate::context::JoshutoContext; -use crate::error::JoshutoError; +use crate::error::JoshutoResult; use crate::ui; use crate::window::JoshutoView; @@ -74,18 +74,11 @@ impl std::fmt::Display for DeleteFiles { } impl JoshutoRunnable for DeleteFiles { - fn execute( - &self, - context: &mut JoshutoContext, - view: &JoshutoView, - ) -> Result<(), JoshutoError> { - let res = Self::delete_files(context, view); + fn execute(&self, context: &mut JoshutoContext, view: &JoshutoView) -> JoshutoResult<()> { + Self::delete_files(context, view)?; let curr_tab = &mut context.tabs[context.curr_tab_index]; curr_tab.refresh(view, &context.config_t); ncurses::doupdate(); - match res { - Ok(_) => Ok(()), - Err(e) => Err(JoshutoError::IO(e)), - } + Ok(()) } } |