pub enum HostError {
Config {
message: String,
},
VenvBuild {
message: String,
},
VenvCommand {
step: &'static str,
context: String,
output: ProcessOutput,
},
WorkerStart {
message: String,
},
WorkerDied {
message: String,
},
Timeout {
timeout_secs: u64,
},
TaskTooLarge {
size: usize,
limit: usize,
},
ResponseTooLarge {
size: usize,
limit: usize,
},
WorkerError {
message: String,
},
Protocol {
message: String,
},
Credential {
message: String,
},
LegacyShim {
hook: String,
message: String,
},
}Expand description
A failure inside the host, before or around the plugin’s own logic.
Variants§
Config
The plugin’s configuration cannot support a venv (no plugin dirs, an unusable class name).
VenvBuild
Building the virtualenv or installing its requirements failed.
VenvCommand
A venv build step that ran a child process and got a non-zero exit.
Split out from Self::VenvBuild so the exit code and stderr survive as
structured details on the PluginError instead of being flattened
into prose a caller has to string-match. step names the command that
failed (“python3 -m venv”, “pip install”) and context the thing it
was acting on (the venv path, the requirements file).
Carries process output — see the redaction note on ProcessOutput.
WorkerStart
The worker subprocess could not be launched.
WorkerDied
The worker process is gone — reader EOF, or a non-zero exit — while a request was outstanding. Distinct from a timeout: there is nothing left to wait for.
Timeout
No response arrived within the per-invocation timeout.
TaskTooLarge
The serialized task exceeded the configured max_content_size. Caught
before the write, so nothing was sent.
ResponseTooLarge
A worker response frame exceeded the configured max_content_size.
Detected mid-read, so the frame was discarded rather than buffered.
WorkerError
The worker returned a structured error response for this request.
Protocol
A payload or response could not be serialized or parsed.
The message must never carry payload values — only the shape of the failure (which field, which type), since it reaches logs.
Credential
A credential-bearing hook could not be served safely, so the host failed closed rather than dispatching without the token.
The message never contains token material.
LegacyShim
A cmf.* hook could not be translated for a worker that predates
cmf.* hook support, so the host failed closed rather than dispatching
a payload the plugin would misread or skipping the plugin.
Like Protocol, the message names shapes (part types, field names),
never payload values.
Implementations§
Source§impl HostError
impl HostError
Sourcepub fn code(&self) -> &'static str
pub fn code(&self) -> &'static str
Short, stable code for the PluginError::Execution.code field, so a
host can branch on the failure mode without string-matching messages.
Sourcepub fn details(&self) -> HashMap<String, Value>
pub fn details(&self) -> HashMap<String, Value>
Machine-readable diagnostics for PluginError::Execution.details.
The Display message is prose for a human; this is the same facts in a
form an operator’s log pipeline or a test can match on without parsing
English. A failed pip install is the motivating case: its exit code
and stderr tail land here rather than only inside the message string.
Variants whose fields are already fully described by the message (and carry no structured facts beyond it) contribute nothing, so the map is empty for them rather than padded with a duplicate of the message.
Every value here reaches logs, so nothing that could hold credential
material — payload values, token bytes — is admitted. The one variant
carrying child-process output is gated by the redaction note on
ProcessOutput.
Sourcepub fn into_plugin_error(self, plugin_name: &str) -> Box<PluginError>
pub fn into_plugin_error(self, plugin_name: &str) -> Box<PluginError>
Convert to the framework error type for a named plugin.
A timeout becomes PluginError::Timeout so the executor’s existing
timeout accounting applies; a config fault becomes
PluginError::Config; everything else is an Execution error the
executor routes through the plugin’s on_error policy.
Trait Implementations§
Source§impl Error for HostError
impl Error for HostError
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()