From 3785202ec5b949cba5501b20729b16f4c29ea626 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Wed, 22 Apr 2026 13:27:43 +0800 Subject: Add new_with_args and dispatch_args_dynamic to Program Remove Display bound from Group type parameter and delete dispatcher_render macro. This is a breaking change. --- mingling_core/src/asset/chain/error.rs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'mingling_core/src/asset/chain') diff --git a/mingling_core/src/asset/chain/error.rs b/mingling_core/src/asset/chain/error.rs index cc22bdc..5221e57 100644 --- a/mingling_core/src/asset/chain/error.rs +++ b/mingling_core/src/asset/chain/error.rs @@ -1,3 +1,5 @@ +use crate::error::{ProgramExecuteError, ProgramInternalExecuteError}; + #[derive(thiserror::Error, Debug)] pub enum ChainProcessError { #[error("Other error: {0}")] @@ -6,3 +8,34 @@ pub enum ChainProcessError { #[error("IO error: {0}")] IO(#[from] std::io::Error), } + +impl From for ChainProcessError { + fn from(value: ProgramExecuteError) -> Self { + match value { + ProgramExecuteError::DispatcherNotFound => { + ChainProcessError::Other("DispatcherNotFound".into()) + } + ProgramExecuteError::RendererNotFound(r) => { + ChainProcessError::Other(format!("RendererNotFound: {}", r)) + } + ProgramExecuteError::Other(e) => ChainProcessError::Other(e), + } + } +} + +impl From for ChainProcessError { + fn from(value: ProgramInternalExecuteError) -> Self { + match value { + ProgramInternalExecuteError::DispatcherNotFound => { + ChainProcessError::Other("DispatcherNotFound".into()) + } + ProgramInternalExecuteError::RendererNotFound(r) => { + ChainProcessError::Other(format!("RendererNotFound: {}", r)) + } + ProgramInternalExecuteError::Other(e) => ChainProcessError::Other(e), + ProgramInternalExecuteError::IO(e) => { + ChainProcessError::Other(format!("IOError: {:?}", e)) + } + } + } +} -- cgit