pub struct ErrorEnvelope {
pub is_error: bool,
pub error_class: ErrorClass,
pub message: String,
pub ora_code: Option<i32>,
pub suggested_tool: Option<String>,
pub fuzzy_matches: Vec<String>,
pub next_steps: Vec<String>,
pub retry_after_ms: Option<u64>,
}Expand description
The actionable, agent-facing error payload (plan §8.2).
is_error is serialized as isError to match the MCP tool-result shape.
Empty optional fields are omitted from the wire form so envelopes stay
terse.
Fields§
§is_error: boolAlways true; marks the MCP tool result as an error.
error_class: ErrorClassThe machine-stable class.
message: StringHuman/LLM-readable explanation. Never contains bind values or secrets.
ora_code: Option<i32>The originating Oracle ORA- code, when the error came from the DB.
suggested_tool: Option<String>The single best tool to call next.
fuzzy_matches: Vec<String>Near-miss candidates (e.g. similarly-named objects) for ObjectNotFound.
next_steps: Vec<String>Ordered, concrete remediation steps an agent can follow.
retry_after_ms: Option<u64>For Busy/Transient: how long to wait before retrying.
Implementations§
Source§impl ErrorEnvelope
impl ErrorEnvelope
Sourcepub fn new(error_class: ErrorClass, message: impl Into<String>) -> Self
pub fn new(error_class: ErrorClass, message: impl Into<String>) -> Self
Construct a new envelope of the given class with a message, deriving the default suggested tool for the class.
Sourcepub fn with_ora_code(self, code: i32) -> Self
pub fn with_ora_code(self, code: i32) -> Self
Attach the originating Oracle error code.
Sourcepub fn with_suggested_tool(self, tool: impl Into<String>) -> Self
pub fn with_suggested_tool(self, tool: impl Into<String>) -> Self
Override the suggested tool.
Sourcepub fn with_fuzzy_matches(self, matches: Vec<String>) -> Self
pub fn with_fuzzy_matches(self, matches: Vec<String>) -> Self
Attach fuzzy near-miss candidates.
Sourcepub fn with_next_step(self, step: impl Into<String>) -> Self
pub fn with_next_step(self, step: impl Into<String>) -> Self
Append a remediation step.
Sourcepub fn with_retry_after_ms(self, ms: u64) -> Self
pub fn with_retry_after_ms(self, ms: u64) -> Self
Attach a retry-after hint (milliseconds).
Sourcepub fn to_json(&self) -> Value
pub fn to_json(&self) -> Value
Render as a serde_json::Value for embedding in an MCP tool result.
§Panics
Never in practice — the envelope is composed of plain owned data that always serializes; a failure would indicate a serde bug, which we surface as a deterministic fallback object rather than unwrapping.
Trait Implementations§
Source§impl Clone for ErrorEnvelope
impl Clone for ErrorEnvelope
Source§fn clone(&self) -> ErrorEnvelope
fn clone(&self) -> ErrorEnvelope
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 ErrorEnvelope
impl Debug for ErrorEnvelope
Source§impl<'de> Deserialize<'de> for ErrorEnvelope
impl<'de> Deserialize<'de> for ErrorEnvelope
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>,
impl Eq for ErrorEnvelope
Source§impl PartialEq for ErrorEnvelope
impl PartialEq for ErrorEnvelope
Source§fn eq(&self, other: &ErrorEnvelope) -> bool
fn eq(&self, other: &ErrorEnvelope) -> bool
self and other values to be equal, and is used by ==.