1use std::io;
2
3use crate::pci::PciBdf;
4
5#[derive(thiserror::Error, Debug)]
6pub enum Error {
7 #[error("io issue encountered: {0}")]
8 Io(#[from] io::Error),
9 #[error("xenstore issue encountered: {0}")]
10 XenStore(#[from] xenstore::error::Error),
11 #[error("xencall issue encountered: {0}")]
12 XenCall(#[from] xencall::error::Error),
13 #[error("domain does not have a tty")]
14 TtyNotFound,
15 #[error("introducing the domain failed")]
16 IntroduceDomainFailed,
17 #[error("string conversion of a path failed")]
18 PathStringConversion,
19 #[error("parent of path not found")]
20 PathParentNotFound,
21 #[error("domain does not exist")]
22 DomainNonExistent,
23 #[error("memory setup failed: {0}")]
24 MemorySetupFailed(&'static str),
25 #[error("populate physmap failed: wanted={0}, received={1}, input_extents={2}")]
26 PopulatePhysmapFailed(usize, usize, usize),
27 #[error("unknown elf compression method")]
28 ElfCompressionUnknown,
29 #[error("expected elf image format not found")]
30 ElfInvalidImage,
31 #[error("provided elf image does not contain xen support")]
32 ElfXenSupportMissing,
33 #[error("regex error: {0}")]
34 RegexError(#[from] regex::Error),
35 #[error("error: {0}")]
36 GenericError(String),
37 #[error("parameter missing: {0}")]
38 ParameterMissing(&'static str),
39 #[error("failed to parse int: {0}")]
40 ParseIntError(#[from] std::num::ParseIntError),
41 #[error("invalid pci bdf string")]
42 InvalidPciBdfString,
43 #[error("pci device {0} is not assignable")]
44 PciDeviceNotAssignable(PciBdf),
45 #[error("xen platform error: {0}")]
46 XenPlatform(#[from] xenplatform::error::Error),
47 #[error("invalid block index")]
48 InvalidBlockIdx,
49 #[error("device state wait error: {0}")]
50 DevStateWaitError(String),
51 #[error("device ids exhausted")]
52 DevIdExhausted,
53}
54
55pub type Result<T> = std::result::Result<T, Error>;