1use fidius_core::PluginError;
18
19#[derive(Debug, thiserror::Error)]
21pub enum LoadError {
22 #[error("library not found: {path}")]
23 LibraryNotFound { path: String },
24
25 #[error("symbol 'fidius_get_registry' not found in {path}")]
26 SymbolNotFound { path: String },
27
28 #[error("invalid magic bytes (expected FIDIUS\\0\\0)")]
29 InvalidMagic,
30
31 #[error("incompatible registry version: got {got}, expected {expected}")]
32 IncompatibleRegistryVersion { got: u32, expected: u32 },
33
34 #[error("incompatible ABI version: got {got}, expected {expected}")]
35 IncompatibleAbiVersion { got: u32, expected: u32 },
36
37 #[error("interface hash mismatch: got {got:#x}, expected {expected:#x}")]
38 InterfaceHashMismatch { got: u64, expected: u64 },
39
40 #[error("buffer strategy mismatch: plugin uses {got}, host expects {expected}")]
41 BufferStrategyMismatch {
42 got: fidius_core::descriptor::BufferStrategyKind,
43 expected: fidius_core::descriptor::BufferStrategyKind,
44 },
45
46 #[error("architecture mismatch: expected {expected}, got {got}")]
47 ArchitectureMismatch { expected: String, got: String },
48
49 #[error("unknown buffer strategy discriminant: {value}")]
50 UnknownBufferStrategy { value: u8 },
51
52 #[error("signature verification failed for {path}")]
53 SignatureInvalid { path: String },
54
55 #[error("signature required but no .sig file found for {path}")]
56 SignatureRequired { path: String },
57
58 #[error("plugin '{name}' not found")]
59 PluginNotFound { name: String },
60
61 #[error("libloading error: {0}")]
62 LibLoading(#[from] libloading::Error),
63
64 #[error("io error: {0}")]
65 Io(#[from] std::io::Error),
66
67 #[error("python load failed: {0}")]
71 PythonLoad(String),
72}
73
74#[derive(Debug, thiserror::Error)]
76pub enum CallError {
77 #[error("serialization error: {0}")]
78 Serialization(String),
79
80 #[error("deserialization error: {0}")]
81 Deserialization(String),
82
83 #[error("plugin error: {0}")]
84 Plugin(PluginError),
85
86 #[error("plugin panicked: {0}")]
87 Panic(String),
88
89 #[error("buffer too small")]
90 BufferTooSmall,
91
92 #[error("method not implemented (capability bit {bit} not set)")]
96 NotImplemented { bit: u32 },
97
98 #[error("invalid method index {index} (plugin has {count} method(s))")]
99 InvalidMethodIndex { index: usize, count: u32 },
100
101 #[error("unknown FFI status code: {code}")]
102 UnknownStatus { code: i32 },
103}