diff options
Diffstat (limited to 'src/cmds/converter/make_sheet_error.rs')
| -rw-r--r-- | src/cmds/converter/make_sheet_error.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/cmds/converter/make_sheet_error.rs b/src/cmds/converter/make_sheet_error.rs new file mode 100644 index 0000000..8bbc45d --- /dev/null +++ b/src/cmds/converter/make_sheet_error.rs @@ -0,0 +1,22 @@ +use crate::systems::cmd::errors::CmdExecuteError; +use just_enough_vcs::system::workspace::workspace::manager::sheet_state::error::MakeSheetError; +use rust_i18n::t; + +pub struct MakeSheetErrorConverter; + +impl MakeSheetErrorConverter { + pub fn to_exec_error(err: MakeSheetError) -> CmdExecuteError { + match err { + MakeSheetError::SheetAlreadyExists => { + CmdExecuteError::Error(t!("make_sheet_error.sheet_already_exists").to_string()) + } + MakeSheetError::SheetNotFound => { + CmdExecuteError::Error(t!("make_sheet_error.sheet_not_found").to_string()) + } + MakeSheetError::Io(error) => CmdExecuteError::Io(error), + MakeSheetError::Other(error) => CmdExecuteError::Error( + t!("make_sheet_error.other", error = error.to_string()).to_string(), + ), + } + } +} |
