chore: Improve error message when reading executors file
--- don't change below this line --- ENG-4088 Took 1 minute Took 7 seconds
This commit is contained in:
@@ -16,7 +16,13 @@ impl SwapEncoderRegistry {
|
|||||||
/// Populates the registry with the `SwapEncoders` for the given blockchain by parsing the
|
/// Populates the registry with the `SwapEncoders` for the given blockchain by parsing the
|
||||||
/// executors' addresses in the file at the given path.
|
/// executors' addresses in the file at the given path.
|
||||||
pub fn new(executors_file_path: &str, blockchain: Chain) -> Result<Self, EncodingError> {
|
pub fn new(executors_file_path: &str, blockchain: Chain) -> Result<Self, EncodingError> {
|
||||||
let config_str = fs::read_to_string(executors_file_path)?;
|
let config_str = fs::read_to_string(executors_file_path).map_err(|e| {
|
||||||
|
EncodingError::FatalError(format!(
|
||||||
|
"Error reading executors file from {}: {}",
|
||||||
|
executors_file_path,
|
||||||
|
e.to_string()
|
||||||
|
))
|
||||||
|
})?;
|
||||||
let config: HashMap<String, HashMap<String, String>> = serde_json::from_str(&config_str)?;
|
let config: HashMap<String, HashMap<String, String>> = serde_json::from_str(&config_str)?;
|
||||||
let mut encoders = HashMap::new();
|
let mut encoders = HashMap::new();
|
||||||
let executors = config
|
let executors = config
|
||||||
|
|||||||
Reference in New Issue
Block a user