hypha: convert to using anyhow for error handling

This commit is contained in:
Alex Zenla
2024-01-30 02:15:03 -08:00
parent a1081ea79c
commit eec213c712
13 changed files with 42 additions and 190 deletions

View File

@ -1,4 +1,4 @@
use crate::error::{HyphaError, Result};
use anyhow::{anyhow, Result};
use loopdev::{LoopControl, LoopDevice};
use xenclient::BlockDeviceRef;
@ -16,11 +16,9 @@ impl AutoLoop {
device.with().read_only(true).attach(file)?;
let path = device
.path()
.ok_or(HyphaError::new("unable to get loop device path"))?
.ok_or(anyhow!("unable to get loop device path"))?
.to_str()
.ok_or(HyphaError::new(
"unable to convert loop device path to string",
))?
.ok_or(anyhow!("unable to convert loop device path to string",))?
.to_string();
let major = device.major()?;
let minor = device.minor()?;