deep_causality/errors/
action_error.rs

1/*
2 * SPDX-License-Identifier: MIT
3 * Copyright (c) "2025" . The DeepCausality Authors and Contributors. All Rights Reserved.
4 */
5
6use std::error::Error;
7use std::fmt;
8
9#[derive(Debug)]
10pub struct ActionError(pub String);
11
12impl ActionError {
13    pub fn new(field0: String) -> Self {
14        Self(field0)
15    }
16}
17
18impl Error for ActionError {}
19
20impl fmt::Display for ActionError {
21    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
22        write!(f, "ActionError: {}", self.0)
23    }
24}
25
26impl From<String> for ActionError {
27    fn from(s: String) -> Self {
28        ActionError(s)
29    }
30}
31
32impl From<ActionError> for deep_causality_core::CausalityError {
33    fn from(err: ActionError) -> Self {
34        deep_causality_core::CausalityError::new(
35            deep_causality_core::CausalityErrorEnum::ActionError(err.0),
36        )
37    }
38}