From 51de1b7f31ed8495f66f0ebf9e0fc4a15e2a5f23 Mon Sep 17 00:00:00 2001 From: Giles Cope Date: Mon, 4 Oct 2021 21:30:52 +0100 Subject: [PATCH 1/3] Say where you looked for the file --- client/chain-spec/src/chain_spec.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/chain-spec/src/chain_spec.rs b/client/chain-spec/src/chain_spec.rs index ff3a99760bd28..b4bb342c88991 100644 --- a/client/chain-spec/src/chain_spec.rs +++ b/client/chain-spec/src/chain_spec.rs @@ -58,8 +58,9 @@ impl GenesisSource { match self { Self::File(path) => { - let file = - File::open(path).map_err(|e| format!("Error opening spec file: {}", e))?; + let file = File::open(path).map_err(|e| { + format!("Error opening spec file at `{}`: {}", &path.to_string_lossy(), e) + })?; let genesis: GenesisContainer = json::from_reader(file) .map_err(|e| format!("Error parsing spec file: {}", e))?; Ok(genesis.genesis) @@ -284,7 +285,8 @@ impl ChainSpec { /// Parse json file into a `ChainSpec` pub fn from_json_file(path: PathBuf) -> Result { - let file = File::open(&path).map_err(|e| format!("Error opening spec file: {}", e))?; + let file = File::open(&path) + .map_err(|e| format!("Error opening spec file `{}`: {}", &path.to_string_lossy(), e))?; let client_spec = json::from_reader(file).map_err(|e| format!("Error parsing spec file: {}", e))?; Ok(ChainSpec { client_spec, genesis: GenesisSource::File(path) }) From 6bc966b0b861c32ca72560b8548e63f202a2bcb6 Mon Sep 17 00:00:00 2001 From: Squirrel Date: Tue, 5 Oct 2021 08:50:53 +0100 Subject: [PATCH 2/3] Update client/chain-spec/src/chain_spec.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- client/chain-spec/src/chain_spec.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/chain-spec/src/chain_spec.rs b/client/chain-spec/src/chain_spec.rs index b4bb342c88991..cfbe3da51c318 100644 --- a/client/chain-spec/src/chain_spec.rs +++ b/client/chain-spec/src/chain_spec.rs @@ -286,7 +286,7 @@ impl ChainSpec { /// Parse json file into a `ChainSpec` pub fn from_json_file(path: PathBuf) -> Result { let file = File::open(&path) - .map_err(|e| format!("Error opening spec file `{}`: {}", &path.to_string_lossy(), e))?; + .map_err(|e| format!("Error opening spec file `{}`: {}", path.display(), e))?; let client_spec = json::from_reader(file).map_err(|e| format!("Error parsing spec file: {}", e))?; Ok(ChainSpec { client_spec, genesis: GenesisSource::File(path) }) From 9eaa166e10e7226819cba4db944e08ce556e7c90 Mon Sep 17 00:00:00 2001 From: Squirrel Date: Tue, 5 Oct 2021 08:53:07 +0100 Subject: [PATCH 3/3] Update client/chain-spec/src/chain_spec.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bastian Köcher --- client/chain-spec/src/chain_spec.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/chain-spec/src/chain_spec.rs b/client/chain-spec/src/chain_spec.rs index cfbe3da51c318..c4db6158125b1 100644 --- a/client/chain-spec/src/chain_spec.rs +++ b/client/chain-spec/src/chain_spec.rs @@ -59,7 +59,7 @@ impl GenesisSource { match self { Self::File(path) => { let file = File::open(path).map_err(|e| { - format!("Error opening spec file at `{}`: {}", &path.to_string_lossy(), e) + format!("Error opening spec file at `{}`: {}", path.display(), e) })?; let genesis: GenesisContainer = json::from_reader(file) .map_err(|e| format!("Error parsing spec file: {}", e))?;