Skip to main content

nylon_ring_host/
error.rs

1use thiserror::Error;
2
3/// Errors that can occur in the nylon-ring-host crate.
4#[derive(Debug, Error)]
5pub enum NylonRingHostError {
6    #[error("failed to load plugin library: {0}")]
7    FailedToLoadLibrary(#[source] libloading::Error),
8
9    #[error("missing required symbol: {0}")]
10    MissingSymbol(String),
11
12    #[error("plugin info pointer is null")]
13    NullPluginInfo,
14
15    #[error("incompatible ABI version: expected {expected}, got {actual}")]
16    IncompatibleAbiVersion { expected: u32, actual: u32 },
17
18    #[error("plugin info is too small: expected at least {expected} bytes, got {actual}")]
19    IncompatiblePluginInfoSize { expected: u32, actual: u32 },
20
21    #[error("plugin vtable is null")]
22    NullPluginVTable,
23
24    #[error("plugin vtable missing required functions")]
25    MissingRequiredFunctions,
26
27    #[error("plugin not found: {0}")]
28    PluginNotFound(String),
29
30    #[error("plugin init failed with status: {0:?}")]
31    PluginInitFailed(nylon_ring::NrStatus),
32
33    #[error("plugin handle failed immediately with status: {0:?}")]
34    PluginHandleFailed(nylon_ring::NrStatus),
35
36    #[error("plugin was unloaded before delivering its response")]
37    PluginUnloaded,
38
39    #[error("plugin panicked while handling the call")]
40    PluginPanicked,
41
42    #[error("synchronous plugin handler returned without delivering a response")]
43    MissingSynchronousResponse,
44
45    #[error("plugin call timed out")]
46    Timeout,
47
48    #[error("plugin calls did not drain before the grace period; {remaining} still active")]
49    DrainTimeout { remaining: usize },
50
51    #[error("plugin is busy with {active_calls} active calls")]
52    PluginBusy { active_calls: usize },
53
54    #[error("the synchronous fast path is already active on this thread")]
55    FastPathReentrant,
56
57    #[error("plugin does not support integer entry dispatch")]
58    EntryDispatchUnsupported,
59
60    #[error("plugin has no entry named: {0}")]
61    EntryNotFound(String),
62}