vapoursynth/map/
errors.rs1use std::ffi::NulError;
2use std::result;
3
4use thiserror::Error;
5
6#[derive(Error, Debug, Eq, PartialEq)]
8pub enum Error {
9 #[error("The requested key wasn't found in the map")]
10 KeyNotFound,
11 #[error("The requested index was out of bounds")]
12 IndexOutOfBounds,
13 #[error("The given/requested value type doesn't match the type of the property")]
14 WrongValueType,
15 #[error("The key is invalid")]
16 InvalidKey(#[from] InvalidKeyError),
17 #[error("Couldn't convert to a CString")]
18 CStringConversion(#[from] NulError),
19 #[error("An unexpected error occurred")]
20 UnknownError,
21}
22
23pub type Result<T> = result::Result<T, Error>;
25
26#[derive(Error, Debug, Eq, PartialEq)]
28#[rustfmt::skip]
29pub enum InvalidKeyError {
30 #[error("The key is empty")]
31 EmptyKey,
32 #[error("The key contains an invalid character at index {}", _0)]
33 InvalidCharacter(usize),
34}