feat(errors): preserve jj-emitted errors when loading config
This commit is contained in:
@@ -41,16 +41,22 @@ impl JjLib {
|
||||
let mut config = StackedConfig::with_defaults();
|
||||
for path in Self::user_config_paths() {
|
||||
if path.is_dir() {
|
||||
config
|
||||
.load_dir(ConfigSource::User, &path)
|
||||
.map_err(|_| Error::FailedReadingConfig)?;
|
||||
config.load_dir(ConfigSource::User, &path).map_err(|e| {
|
||||
Error::FailedReadingConfig {
|
||||
context: e.to_string(),
|
||||
}
|
||||
})?;
|
||||
} else if path.exists() {
|
||||
config
|
||||
.load_file(ConfigSource::User, path)
|
||||
.map_err(|_| Error::FailedReadingConfig)?;
|
||||
config.load_file(ConfigSource::User, path).map_err(|e| {
|
||||
Error::FailedReadingConfig {
|
||||
context: e.to_string(),
|
||||
}
|
||||
})?;
|
||||
}
|
||||
}
|
||||
UserSettings::from_config(config).map_err(|_| Error::FailedReadingConfig)
|
||||
UserSettings::from_config(config).map_err(|e| Error::FailedReadingConfig {
|
||||
context: e.to_string(),
|
||||
})
|
||||
}
|
||||
|
||||
/// Resolves user config file paths following the same logic as the jj CLI:
|
||||
|
||||
Reference in New Issue
Block a user