diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-03-25 09:57:21 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-03-25 11:34:01 +0200 |
commit | 23138e5bdb8ca751834009d99d85b37e5e4ae5ae (patch) | |
tree | 27e9b77e04a877a3efdb7b9795f5977060b3488a /src/install.rs | |
parent | 6497e12ae4df4c7cb98992f5cf1948b3eebc486d (diff) | |
download | vmadm-23138e5bdb8ca751834009d99d85b37e5e4ae5ae.tar.gz |
feat: give more useful and specific error messages
Diffstat (limited to 'src/install.rs')
-rw-r--r-- | src/install.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/install.rs b/src/install.rs index dce0fea..e74e6ba 100644 --- a/src/install.rs +++ b/src/install.rs @@ -17,9 +17,9 @@ pub enum VirtInstallError { #[error("virt-install failed: {0}")] VirtInstallFailed(String), - /// I/O error. - #[error(transparent)] - IoError(#[from] std::io::Error), + /// Failed to run virt-install. + #[error("couldn't run virt-install")] + Run(#[source] std::io::Error), /// Error parsing a string as UTF8. #[error(transparent)] @@ -115,7 +115,8 @@ pub fn virt_install(args: &VirtInstallArgs, iso: &Path) -> Result<PathBuf, VirtI .arg("--graphics=spice") .arg("--noautoconsole") .arg("--quiet") - .output()?; + .output() + .map_err(|err| VirtInstallError::Run(err))?; if !r.status.success() { let stderr = String::from_utf8(r.stderr)?; return Err(VirtInstallError::VirtInstallFailed(stderr)); |