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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user