summaryrefslogtreecommitdiff
path: root/mingling/src/program/exec
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-03-29 00:52:16 +0800
committer魏曹先生 <1992414357@qq.com>2026-03-29 00:52:28 +0800
commitdb9afa0b06355028eafe3bc29fe0b2429ba8fd0a (patch)
tree60bf74d0853fcc0c1e9363813c26109a6ca38a4f /mingling/src/program/exec
parent7ce68cd11516bd7cf037ecea99a92aee7c31b2c3 (diff)
Completed the first preliminary usable version of the Mingling
framework.
Diffstat (limited to 'mingling/src/program/exec')
-rw-r--r--mingling/src/program/exec/error.rs44
1 files changed, 44 insertions, 0 deletions
diff --git a/mingling/src/program/exec/error.rs b/mingling/src/program/exec/error.rs
new file mode 100644
index 0000000..0523ea5
--- /dev/null
+++ b/mingling/src/program/exec/error.rs
@@ -0,0 +1,44 @@
+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(format!("Broken")),
+ }
+ }
+}