feat: better error message on wrong os-release file (#511)

* enhancement: better error message when os-release parsing fails
This commit is contained in:
6543
2023-07-24 02:27:13 +02:00
committed by GitHub
parent d21141fefe
commit 1307d2d7e8
4 changed files with 70 additions and 24 deletions

View File

@@ -114,10 +114,14 @@ impl Distribution {
if PathBuf::from(OS_RELEASE_PATH).exists() {
let os_release = Ini::load_from_file(OS_RELEASE_PATH)?;
if os_release.general_section().is_empty() {
return Err(TopgradeError::EmptyOSReleaseFile.into());
}
return Self::parse_os_release(&os_release);
}
Err(TopgradeError::UnknownLinuxDistribution.into())
Err(TopgradeError::EmptyOSReleaseFile.into())
}
pub fn upgrade(self, ctx: &ExecutionContext) -> Result<()> {