mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 17:28:00 +00:00
Improved file not found error message (#9931)
* Say where you looked for the file Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -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) })
|
||||
|
||||
Reference in New Issue
Block a user