Skip to content

Commit

Permalink
feat(pcli): more informative error message
Browse files Browse the repository at this point in the history
Follow up to the new `pcli init` logic [0], adding a more informative
error message, in case folks forget to rotate their address format, as
required by Rhea 63.

[0] #3239
  • Loading branch information
conorsch committed Oct 31, 2023
1 parent ab1af63 commit dda89fc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions crates/bin/pcli/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::path::Path;

use anyhow::Result;
use anyhow::{Context, Result};
use serde::{Deserialize, Serialize};
use serde_with::{serde_as, DisplayFromStr};
use url::Url;
Expand All @@ -27,8 +27,11 @@ pub struct PcliConfig {
}

impl PcliConfig {
pub fn load<P: AsRef<Path>>(path: P) -> Result<Self> {
let contents = std::fs::read_to_string(path)?;
pub fn load<P: AsRef<Path> + std::fmt::Display>(path: P) -> Result<Self> {
let contents = std::fs::read_to_string(&path).context(format!(
"pcli config file not found: {}. hint: run 'pcli init' to create new keys",
&path
))?;
Ok(toml::from_str(&contents)?)
}

Expand Down

0 comments on commit dda89fc

Please sign in to comment.