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