fix: Implement From<SimulationError> for EncodingError
Took 6 minutes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use std::{io, str::Utf8Error};
|
||||
|
||||
use thiserror::Error;
|
||||
use tycho_common::simulation::errors::SimulationError;
|
||||
|
||||
/// Represents the outer-level, user-facing errors of the tycho-execution encoding package.
|
||||
///
|
||||
@@ -41,3 +42,15 @@ impl From<Utf8Error> for EncodingError {
|
||||
EncodingError::FatalError(err.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<SimulationError> for EncodingError {
|
||||
fn from(err: SimulationError) -> Self {
|
||||
match err {
|
||||
SimulationError::FatalError(err_msg) => EncodingError::FatalError(err_msg),
|
||||
SimulationError::InvalidInput(err_msg, ..) => EncodingError::InvalidInput(err_msg),
|
||||
SimulationError::RecoverableError(error_msg) => {
|
||||
EncodingError::RecoverableError(error_msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -779,8 +779,7 @@ impl SwapEncoder for BebopSwapEncoder {
|
||||
.request_signed_quote(params)
|
||||
.await
|
||||
})
|
||||
})
|
||||
.map_err(|e| EncodingError::FatalError(format!("Failed to get Bebop quote {e}")))?;
|
||||
})?;
|
||||
let bebop_calldata = signed_quote
|
||||
.quote_attributes
|
||||
.get("calldata")
|
||||
|
||||
Reference in New Issue
Block a user