bootmgr_rs_core/
error.rs

1// SPDX-FileCopyrightText: 2025 some100 <ootinnyoo@outlook.com>
2// SPDX-License-Identifier: MIT
3
4//! Provides [`BootError`], which encapsulates other errors
5
6use thiserror::Error;
7
8/// An `Error` resulting from the program.
9#[derive(Error, Debug)]
10pub enum BootError {
11    /// An error with UEFI, or a service from the [`uefi`] crate.
12    #[error("UEFI Error: {0}")]
13    Uefi(#[from] uefi::Error),
14
15    /// A `String` could not be converted into a `CString`
16    #[error("String Conversion Error: {0}")]
17    StrError(#[from] crate::system::helper::StrError),
18
19    /// An error occurred while performing filesystem operations.
20    #[error("Filesystem Error: {0}")]
21    FsError(#[from] crate::system::fs::FsError),
22
23    /// An error occurred while validating an image with Secure Boot.
24    #[error("Secure Boot Error: {0}")]
25    SecureBootError(#[from] crate::boot::secure_boot::SecureBootError),
26
27    /// An error occurred while building a `DevicePath`.
28    #[error("DevicePath Error: {0}")]
29    DevicePathError(#[from] crate::system::helper::DevicePathError),
30
31    /// An error occurred while loading an image.
32    #[error("Load Image Error: {0}")]
33    LoadError(#[from] crate::boot::loader::LoadError),
34
35    /// An error occurred while loading a driver.
36    #[error("Load Driver Error: {0}")]
37    DriverError(#[from] crate::system::drivers::DriverError),
38
39    /// An error occurred while loading a devicetree.
40    #[error("Devicetree Error: {0}")]
41    DevicetreeError(#[from] crate::boot::devicetree::DevicetreeError),
42
43    /// An error occurred while interacting with UEFI variables.
44    #[error("UEFI Variable Error: {0}")]
45    VarError(#[from] crate::system::variable::VarError),
46
47    /// The UKI executable could not be parsed for any reason.
48    #[cfg(feature = "uki")]
49    #[error("Uki Parse Error: {0}")]
50    UkiError(#[from] crate::config::parsers::uki::UkiError),
51
52    /// The BCD could not be parsed for any reason.
53    #[cfg(feature = "windows_bcd")]
54    #[error("Win Parse Error: {0}")]
55    WinError(#[from] crate::config::parsers::windows::windows_bcd::WinError),
56}