summaryrefslogtreecommitdiffstats
path: root/src/commands/change_directory.rs
diff options
context:
space:
mode:
authorJiayi Zhao <jeff.no.zhao@gmail.com>2019-06-29 22:19:47 -0400
committerJiayi Zhao <jeff.no.zhao@gmail.com>2019-06-29 22:23:31 -0400
commit65f0f33a564d91bd8126ce684c02f245e5ea9a1f (patch)
treebc9bb5d877cee131dc7870c5f9f5d0c71898efbd /src/commands/change_directory.rs
parent58f6428e2aead58b7f930008b294ce56df59e3cb (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/change_directory.rs')
-rw-r--r--src/commands/change_directory.rs13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/commands/change_directory.rs b/src/commands/change_directory.rs
index 27fa809..330c8b2 100644
--- a/src/commands/change_directory.rs
+++ b/src/commands/change_directory.rs
@@ -3,7 +3,7 @@ use std::path;
use crate::commands;
use crate::context::JoshutoContext;
-use crate::error::JoshutoError;
+use crate::error::JoshutoResult;
use crate::history::DirectoryHistory;
use crate::window::JoshutoView;
use commands::{JoshutoCommand, JoshutoRunnable};
@@ -58,15 +58,8 @@ impl std::fmt::Display for ChangeDirectory {
}
impl JoshutoRunnable for ChangeDirectory {
- fn execute(
- &self,
- context: &mut JoshutoContext,
- view: &JoshutoView,
- ) -> Result<(), JoshutoError> {
- match Self::change_directory(&self.path, context, view) {
- Ok(_) => {}
- Err(e) => return Err(JoshutoError::IO(e)),
- }
+ fn execute(&self, context: &mut JoshutoContext, view: &JoshutoView) -> JoshutoResult<()> {
+ Self::change_directory(&self.path, context, view)?;
ncurses::doupdate();
Ok(())
}