1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use crate::Region;
use thiserror::Error;
#[derive(Debug, Error, PartialEq, Eq)]
pub enum GuestError {
#[error("Invalid flag value {0}")]
InvalidFlagValue(&'static str),
#[error("Invalid enum value {0}")]
InvalidEnumValue(&'static str),
#[error("Pointer overflow")]
PtrOverflow,
#[error("Pointer out of bounds: {0:?}")]
PtrOutOfBounds(Region),
#[error("Pointer not aligned to {1}: {0:?}")]
PtrNotAligned(Region, u32),
#[error("Pointer already borrowed: {0:?}")]
PtrBorrowed(Region),
#[error("Borrow checker out of handles")]
BorrowCheckerOutOfHandles,
#[error("Slice length mismatch")]
SliceLengthsDiffer,
#[error("In func {modulename}::{funcname} at {location}: {err}")]
InFunc {
modulename: &'static str,
funcname: &'static str,
location: &'static str,
#[source]
err: Box<GuestError>,
},
#[error("Invalid UTF-8 encountered: {0:?}")]
InvalidUtf8(#[from] ::std::str::Utf8Error),
#[error("Int conversion error: {0:?}")]
TryFromIntError(#[from] ::std::num::TryFromIntError),
}