1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
use crate::systems::cmd::errors::CmdExecuteError;
use just_enough_vcs::system::workspace::workspace::error::WorkspaceOperationError;
use rust_i18n::t;
pub struct JVWorkspaceOperationErrorConverter;
impl JVWorkspaceOperationErrorConverter {
pub fn to_exec_error(err: WorkspaceOperationError) -> CmdExecuteError {
match err {
WorkspaceOperationError::Io(error) => CmdExecuteError::Io(error),
WorkspaceOperationError::Other(msg) => CmdExecuteError::Error(msg),
WorkspaceOperationError::ConfigNotFound => {
CmdExecuteError::Error(t!("workspace_operation_error.config_not_found").to_string())
}
WorkspaceOperationError::WorkspaceNotFound => CmdExecuteError::Error(
t!("workspace_operation_error.workspace_not_found").to_string(),
),
WorkspaceOperationError::HandleLock(handle_lock_error) => CmdExecuteError::Error(
t!(
"workspace_operation_error.handle_lock",
error = handle_lock_error
)
.to_string(),
),
WorkspaceOperationError::DataRead(data_read_error) => CmdExecuteError::Error(
t!(
"workspace_operation_error.data_read",
error = data_read_error
)
.to_string(),
),
WorkspaceOperationError::DataWrite(data_write_error) => CmdExecuteError::Error(
t!(
"workspace_operation_error.data_write",
error = data_write_error
)
.to_string(),
),
WorkspaceOperationError::DataApply(data_apply_error) => CmdExecuteError::Error(
t!(
"workspace_operation_error.data_apply",
error = data_apply_error
)
.to_string(),
),
WorkspaceOperationError::IDAliasError(id_alias_error) => CmdExecuteError::Error(
t!(
"workspace_operation_error.id_alias_error",
error = id_alias_error
)
.to_string(),
),
}
}
}
|