1#[derive(Debug)]
5pub enum BitcodeError {
6 InvalidMagic,
8 TruncatedInput,
10 UnexpectedEof,
12 UnsupportedRecord(u32),
14 InvalidType,
16 ParseError(String),
18}
19
20impl std::fmt::Display for BitcodeError {
21 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22 match self {
23 BitcodeError::InvalidMagic => write!(f, "invalid magic bytes (not LRIR format)"),
24 BitcodeError::TruncatedInput => write!(f, "input is truncated"),
25 BitcodeError::UnexpectedEof => write!(f, "unexpected end of file"),
26 BitcodeError::UnsupportedRecord(t) => write!(f, "unsupported record type: {}", t),
27 BitcodeError::InvalidType => write!(f, "invalid type tag"),
28 BitcodeError::ParseError(msg) => write!(f, "parse error: {}", msg),
29 }
30 }
31}
32
33impl std::error::Error for BitcodeError {}