fusion_core/component/
error.rs

1use thiserror::Error;
2
3use crate::DataError;
4
5pub type ComponentResult<T> = core::result::Result<T, ComponentError>;
6
7#[derive(Debug, Error)]
8pub enum ComponentError {
9  #[error("Component not found, name is {0}")]
10  ComponentNotFound(String),
11
12  #[error("Component type mismatch, type is {0}")]
13  ComponentTypeMismatch(&'static str),
14}
15
16impl From<ComponentError> for DataError {
17  fn from(value: ComponentError) -> Self {
18    DataError::internal(500, value.to_string(), Some(Box::new(value)))
19  }
20}