From dee8542b4537715f2224f14b50179a756f7ccd50 Mon Sep 17 00:00:00 2001 From: Diana Carvalho Date: Thu, 6 Feb 2025 12:13:38 +0000 Subject: [PATCH] chore: Improve error message when reading executors file --- don't change below this line --- ENG-4088 Took 1 minute Took 7 seconds --- src/encoding/evm/swap_encoder/swap_encoder_registry.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/encoding/evm/swap_encoder/swap_encoder_registry.rs b/src/encoding/evm/swap_encoder/swap_encoder_registry.rs index a9bb22f..f0bd2a8 100644 --- a/src/encoding/evm/swap_encoder/swap_encoder_registry.rs +++ b/src/encoding/evm/swap_encoder/swap_encoder_registry.rs @@ -16,7 +16,13 @@ impl SwapEncoderRegistry { /// Populates the registry with the `SwapEncoders` for the given blockchain by parsing the /// executors' addresses in the file at the given path. pub fn new(executors_file_path: &str, blockchain: Chain) -> Result { - 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> = serde_json::from_str(&config_str)?; let mut encoders = HashMap::new(); let executors = config