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/run.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/run.rs')
-rw-r--r-- | src/run.rs | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -4,7 +4,6 @@ use std::time; use crate::commands::{CommandKeybind, FileOperationThread, JoshutoCommand, ReloadDirList}; use crate::config::{self, JoshutoCommandMapping, JoshutoConfig}; use crate::context::JoshutoContext; -use crate::error::JoshutoError; use crate::tab::JoshutoTab; use crate::ui; use crate::window::JoshutoPanel; @@ -97,7 +96,7 @@ fn process_threads(context: &mut JoshutoContext, view: &JoshutoView) -> std::io: break; } Ok(progress_info) => { - ui::show_fs_operation_progress(&view.bot_win, &progress_info); + ui::draw_fs_operation_progress(&view.bot_win, &progress_info); ncurses::doupdate(); } _ => {} @@ -190,12 +189,8 @@ pub fn run(config_t: JoshutoConfig, keymap_t: JoshutoCommandMapping) { } match keycommand.execute(&mut context, &view) { Ok(()) => {} - Err(JoshutoError::IO(e)) => { - ui::wprint_err(&view.bot_win, e.to_string().as_str()); - ncurses::doupdate(); - } - Err(JoshutoError::Keymap(e)) => { - ui::wprint_err(&view.bot_win, e.to_string().as_str()); + Err(e) => { + ui::wprint_err(&view.bot_win, e.cause()); ncurses::doupdate(); } } |