Skip to main content

camel_bean/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum BeanError {
5    #[error("Bean not found: {0}")]
6    NotFound(String),
7
8    #[error("Bean method not found: {0}")]
9    MethodNotFound(String),
10
11    #[error("Parameter binding failed: {0}")]
12    BindingFailed(String),
13
14    #[error("Handler execution failed: {0}")]
15    ExecutionFailed(String),
16
17    #[error("Bean already registered: {0}")]
18    DuplicateName(String),
19}
20
21impl From<BeanError> for camel_api::CamelError {
22    fn from(err: BeanError) -> Self {
23        camel_api::CamelError::ProcessorError(err.to_string())
24    }
25}