1use std::{error::Error, fmt};
4
5pub static ERRORS: [&[u8]; 12] = [
6 b"Plugin OK\0",
8 b"Undefined error\0",
10 b"Plugin failed to initialize\0",
12 b"Attribute does not exist\0",
14 b"Attribute types do not match\0",
16 b"Attribute cannot be set\0",
18 b"IO operation failed\0",
20 b"Could not convert numeric value into a different type\0",
22 b"The plugin encountered a null pointer\0",
24 b"The plugin attribute's callback failed\0",
26 b"Could not update plugin attribute's cached value\0",
28 b"Unrecognized lifecycle phase\0",
30];
31
32#[derive(Debug)]
37pub struct PluginUninitializedError {}
38
39impl Error for PluginUninitializedError {}
40
41impl fmt::Display for PluginUninitializedError {
42 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
43 write!(f, "PluginUninitializederror")
44 }
45}
46
47pub mod error_codes {
48 use libc::c_int;
50
51 pub const PLUGIN_OK: c_int = 0;
52 pub const UNDEFINED_ERR: c_int = 1;
53 pub const PLUGIN_INIT_ERR: c_int = 2;
54 pub const ATTRIBUTE_DOES_NOT_EXIST: c_int = 3;
55 pub const ATTRIBUTE_TYPE_MISMATCH: c_int = 4;
56 pub const ATTRIBUTE_IS_NOT_SETTABLE: c_int = 5;
57 pub const IO_ERR: c_int = 6;
58 pub const NUMERIC_CONVERSION_ERR: c_int = 7;
59 pub const NULL_PTR_ERR: c_int = 8;
60 pub const CALLBACK_ERR: c_int = 9;
61 pub const UPDATE_CACHED_VALUE_ERR: c_int = 10;
62 pub const LIFECYCLE_PHASE_ERR: c_int = 11;
63}