pub struct PluginError {
pub code: String,
pub message: String,
pub details: Option<String>,
}Expand description
Error returned by plugin method implementations to signal business logic failures.
Serialized across the FFI boundary via the wire format. The host deserializes
this from the output buffer when the FFI shim returns STATUS_PLUGIN_ERROR.
The details field is stored as a JSON string (not serde_json::Value)
so that it serializes correctly under both JSON and bincode wire formats.
Fields§
§code: StringMachine-readable error code (e.g., "INVALID_INPUT", "NOT_FOUND").
message: StringHuman-readable error message.
details: Option<String>Optional structured details as a JSON string.
Implementations§
Source§impl PluginError
impl PluginError
Sourcepub fn new(code: impl Into<String>, message: impl Into<String>) -> Self
pub fn new(code: impl Into<String>, message: impl Into<String>) -> Self
Create a new PluginError without details.
Sourcepub fn with_details(
code: impl Into<String>,
message: impl Into<String>,
details: Value,
) -> Self
pub fn with_details( code: impl Into<String>, message: impl Into<String>, details: Value, ) -> Self
Create a new PluginError with structured details.
The serde_json::Value is serialized to a JSON string for storage.
Sourcepub fn details_value(&self) -> Option<Value>
pub fn details_value(&self) -> Option<Value>
Parse the details field back into a serde_json::Value.
Returns None if details is absent or fails to parse.
Trait Implementations§
Source§impl Clone for PluginError
impl Clone for PluginError
Source§fn clone(&self) -> PluginError
fn clone(&self) -> PluginError
1.0.0 · 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<'de> Deserialize<'de> for PluginError
impl<'de> Deserialize<'de> for PluginError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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()