aboutsummaryrefslogtreecommitdiff
path: root/mingling_core/src/program/exec
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-03-29 21:48:23 +0800
committer魏曹先生 <1992414357@qq.com>2026-03-29 21:48:23 +0800
commit596e5e2440df2d32f1cf3e052dc633e774edf6ee (patch)
treedc98eb6a1789847b899207d0b99337bb3ccd92a5 /mingling_core/src/program/exec
parent25a164f74c011e6e78846f226cbd7a8bd87db92f (diff)
Rename mingling to mingling_core and update dependencies
Diffstat (limited to 'mingling_core/src/program/exec')
-rw-r--r--mingling_core/src/program/exec/error.rs46
1 files changed, 46 insertions, 0 deletions
diff --git a/mingling_core/src/program/exec/error.rs b/mingling_core/src/program/exec/error.rs
new file mode 100644
index 0000000..fe66e22
--- /dev/null
+++ b/mingling_core/src/program/exec/error.rs
@@ -0,0 +1,46 @@
+use crate::error::ChainProcessError;
+
+#[derive(thiserror::Error, Debug)]
+pub enum ProgramExecuteError {
+ #[error("No Dispatcher Found")]
+ DispatcherNotFound,
+
+ #[error("Other error: {0}")]
+ Other(String),
+}
+
+#[derive(thiserror::Error, Debug)]
+pub enum ProgramInternalExecuteError {
+ #[error("No Dispatcher Found")]
+ DispatcherNotFound,
+
+ #[error("Other error: {0}")]
+ Other(String),
+
+ #[error("IO error: {0}")]
+ IO(#[from] std::io::Error),
+}
+
+impl From<ProgramInternalExecuteError> for ProgramExecuteError {
+ fn from(value: ProgramInternalExecuteError) -> Self {
+ match value {
+ ProgramInternalExecuteError::DispatcherNotFound => {
+ ProgramExecuteError::DispatcherNotFound
+ }
+ ProgramInternalExecuteError::Other(s) => ProgramExecuteError::Other(s),
+ ProgramInternalExecuteError::IO(e) => ProgramExecuteError::Other(format!("{}", e)),
+ }
+ }
+}
+
+impl From<ChainProcessError> for ProgramInternalExecuteError {
+ fn from(value: ChainProcessError) -> Self {
+ match value {
+ ChainProcessError::Other(s) => ProgramInternalExecuteError::Other(s),
+ ChainProcessError::IO(error) => ProgramInternalExecuteError::IO(error),
+ ChainProcessError::Broken(_) => {
+ ProgramInternalExecuteError::Other("Broken".to_string())
+ }
+ }
+ }
+}