introduce the use of anyhow to no longer use panic

This commit is contained in:
2025-10-11 14:35:29 -07:00
parent 449eb85ab8
commit fc239ea54d
14 changed files with 121 additions and 84 deletions

View File

@@ -1,6 +1,7 @@
use anyhow::{Context, Result};
use std::os::uefi as uefi_std;
pub fn init() {
pub fn init() -> Result<()> {
let system_table = uefi_std::env::system_table();
let image_handle = uefi_std::env::image_handle();
@@ -10,9 +11,10 @@ pub fn init() {
unsafe {
uefi::table::set_system_table(system_table.as_ptr().cast());
let handle = uefi::Handle::from_ptr(image_handle.as_ptr().cast())
.expect("unable to resolve image handle");
.context("unable to resolve image handle")?;
uefi::boot::set_image_handle(handle);
}
uefi::helpers::init().expect("failed to initialize uefi");
uefi::helpers::init().context("failed to initialize uefi")?;
Ok(())
}