#[non_exhaustive]pub enum PluginError {
Compile {
path: PathBuf,
message: String,
},
Runtime {
id: String,
message: String,
},
ResourceExceeded {
id: String,
limit: ResourceLimit,
},
Timeout {
id: String,
},
MalformedReturn {
id: String,
message: String,
},
UnknownDataDep {
path: PathBuf,
name: String,
},
MalformedDataDeps {
path: PathBuf,
message: String,
},
IdCollision {
id: String,
winner: CollisionWinner,
loser_path: PathBuf,
},
}Expand description
Every failure mode a plugin can hit at load time or render time.
Variants match plugin-api.md §Edge cases; error copy is aimed at
the person reading linesmith doctor output, not the plugin
author’s script.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Compile
Rhai script failed to parse or compile at load time.
Runtime
Script runtime error during render(ctx) — any thrown rhai
error that wasn’t a resource-limit hit. Drops the segment for
this invocation; logged once.
ResourceExceeded
Script exceeded a configured rhai resource limit per
plugin-api.md §Resource ceilings. Drops the segment; logged.
Timeout
Host-side wallclock timer fired before the script returned
(default 50ms per render). Distinct from ResourceExceeded { limit: MaxOperations }, which covers CPU-budget overruns
surfaced by rhai itself. Drops the segment; logged.
MalformedReturn
render(ctx) returned a value that isn’t () and isn’t a map
matching the RenderedSegment shape. Drops the segment.
UnknownDataDep
@data_deps declared a name that isn’t in the plugin-accessible
set defined by header::KNOWN_DEPS. Per
plugin-api.md §@data_deps header syntax, credentials and
jsonl are reserved and surface here alongside truly unknown
names; consumer-side handling of those reserved names lives
in linesmith-core. path rather than id because header
parsing fires before const ID has been extracted from the
script.
MalformedDataDeps
@data_deps = ... header didn’t parse as a JSON-style array of
bare-string dep names. Same path-over-id rationale as
Self::UnknownDataDep.
IdCollision
Two discovered plugins (or a plugin and a built-in) claim the
same id. First-discovered wins per the precedence rules in
plugin-api.md §Plugin file location; loser is rejected.
Implementations§
Source§impl PluginError
impl PluginError
Sourcepub fn kind(&self) -> &'static str
pub fn kind(&self) -> &'static str
Static variant tag — guaranteed token-free &'static str,
safe to render in any user-facing diagnostic. Use this in
place of Display or Debug when the consumer might be
rendering plugin-author-controlled data (e.g., Runtime { message } and MalformedReturn { message } carry strings
the script author wrote, which can leak secrets via
throw("...")).
Trait Implementations§
Source§impl Clone for PluginError
impl Clone for PluginError
Source§fn clone(&self) -> PluginError
fn clone(&self) -> PluginError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PluginError
impl Debug for PluginError
Source§impl Display for PluginError
impl Display for PluginError
Source§impl Error for PluginError
impl Error for PluginError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for PluginError
impl PartialEq for PluginError
Source§fn eq(&self, other: &PluginError) -> bool
fn eq(&self, other: &PluginError) -> bool
self and other values to be equal, and is used by ==.