mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-19 19:08:08 +00:00
config: remove unused ConfigEnvError variant, convert io::Error explicitly
It wasn't obvious which io::Error was mapped to a "file creation" error. Perhaps, file creation will be moved to caller, but let's make the error handling explicit so we'll remove the unused error variant later.
This commit is contained in:
parent
4b1a057fd4
commit
67f8a59643
1 changed files with 2 additions and 4 deletions
|
@ -53,12 +53,10 @@ pub fn parse_toml_value_or_bare_string(value_str: &str) -> toml_edit::Value {
|
|||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum ConfigEnvError {
|
||||
#[error(transparent)]
|
||||
ConfigReadError(#[from] ConfigError),
|
||||
#[error("Both {0} and {1} exist. Please consolidate your configs in one of them.")]
|
||||
AmbiguousSource(PathBuf, PathBuf),
|
||||
#[error(transparent)]
|
||||
ConfigCreateError(#[from] std::io::Error),
|
||||
CreateFile(std::io::Error),
|
||||
}
|
||||
|
||||
/// Configuration variable with its source information.
|
||||
|
@ -255,7 +253,7 @@ impl ConfigEnv {
|
|||
// to create an empty file to be overwritten. Since it's unclear
|
||||
// who and when to update ConfigPath::New(_) to ::Existing(_),
|
||||
// it's probably better to not cache the path existence.
|
||||
create_config_file(path)?;
|
||||
create_config_file(path).map_err(ConfigEnvError::CreateFile)?;
|
||||
Ok(Some(path))
|
||||
}
|
||||
ConfigPath::Unavailable => Ok(None),
|
||||
|
|
Loading…
Reference in a new issue