Skip to content

Commit 562c1ce

Browse files
install/composefs: Return result from opts.validate
Signed-off-by: Pragyan Poudyal <[email protected]>
1 parent 39a3355 commit 562c1ce

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/src/install.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -560,13 +560,15 @@ impl FromStr for MountSpec {
560560
}
561561

562562
impl InstallToDiskOpts {
563-
pub(crate) fn validate(&self) {
563+
pub(crate) fn validate(&self) -> Result<()> {
564564
if !self.composefs_native {
565565
// Reject using --boot without --composefs
566566
if self.composefs_opts.boot != BootType::default() {
567-
panic!("--boot must not be provided without --composefs");
567+
anyhow::bail!("--boot must not be provided without --composefs");
568568
}
569569
}
570+
571+
Ok(())
570572
}
571573
}
572574

@@ -1724,7 +1726,7 @@ fn installation_complete() {
17241726
#[context("Installing to disk")]
17251727
#[cfg(feature = "install-to-disk")]
17261728
pub(crate) async fn install_to_disk(mut opts: InstallToDiskOpts) -> Result<()> {
1727-
opts.validate();
1729+
opts.validate()?;
17281730

17291731
let mut block_opts = opts.block_opts;
17301732
let target_blockdev_meta = block_opts

0 commit comments

Comments
 (0)