tycho_common/simulation/
errors.rs1use thiserror::Error;
2
3use crate::{hex_bytes::IntegerFromBytesError, simulation::protocol_sim::GetAmountOutResult};
4
5#[derive(Error, Debug)]
16pub enum SimulationError {
17 #[error("Fatal error: {0}")]
18 FatalError(String),
19 #[error("Invalid input: {0}")]
20 InvalidInput(String, Option<GetAmountOutResult>),
21 #[error("Recoverable error: {0}")]
22 RecoverableError(String),
23}
24
25#[derive(Debug)]
26pub enum TransitionError {
27 MissingAttribute(String),
28 DecodeError(String),
29 InvalidEventType(),
30 SimulationError(SimulationError),
31}
32
33impl From<SimulationError> for TransitionError {
34 fn from(error: SimulationError) -> Self {
35 TransitionError::SimulationError(error)
36 }
37}
38
39impl From<IntegerFromBytesError> for TransitionError {
40 fn from(error: IntegerFromBytesError) -> Self {
41 TransitionError::DecodeError(error.to_string())
42 }
43}