Skip to content

Commit 42632ce

Browse files
install/composefs: Return result from opts.validate
Signed-off-by: Pragyan Poudyal <[email protected]>
1 parent 79f3957 commit 42632ce

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
@@ -561,13 +561,15 @@ impl FromStr for MountSpec {
561561
}
562562

563563
impl InstallToDiskOpts {
564-
pub(crate) fn validate(&self) {
564+
pub(crate) fn validate(&self) -> Result<()> {
565565
if !self.composefs_native {
566566
// Reject using --boot without --composefs
567567
if self.composefs_opts.boot != BootType::default() {
568-
panic!("--boot must not be provided without --composefs");
568+
anyhow::bail!("--boot must not be provided without --composefs");
569569
}
570570
}
571+
572+
Ok(())
571573
}
572574
}
573575

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

17311733
let mut block_opts = opts.block_opts;
17321734
let target_blockdev_meta = block_opts

0 commit comments

Comments
 (0)