Skip to content
Snippets Groups Projects
Commit 3a53892e authored by Squirrel's avatar Squirrel Committed by GitHub
Browse files

Improved file not found error message (#9931)


* Say where you looked for the file

Co-authored-by: default avatarBastian Köcher <bkchr@users.noreply.github.com>
parent 626ca933
No related merge requests found
......@@ -58,8 +58,9 @@ impl<G: RuntimeGenesis> GenesisSource<G> {
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.display(), e)
})?;
let genesis: GenesisContainer<G> = json::from_reader(file)
.map_err(|e| format!("Error parsing spec file: {}", e))?;
Ok(genesis.genesis)
......@@ -284,7 +285,8 @@ impl<G, E: serde::de::DeserializeOwned> ChainSpec<G, E> {
/// Parse json file into a `ChainSpec`
pub fn from_json_file(path: PathBuf) -> Result<Self, String> {
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.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) })
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment