pub struct SisterError {
pub code: ErrorCode,
pub severity: Severity,
pub message: String,
pub context: Option<HashMap<String, Value>>,
pub recoverable: bool,
pub suggested_action: Option<SuggestedAction>,
}Expand description
Standard error type for ALL sisters — domain/business logic errors.
These errors occur AFTER a tool is found and invoked.
In MCP, they become {isError: true} in the tool result,
NOT JSON-RPC error responses.
Fields§
§code: ErrorCodeError code (machine-readable)
severity: SeveritySeverity level
message: StringHuman-readable message (should be actionable for LLMs)
context: Option<HashMap<String, Value>>Additional context (for debugging)
recoverable: boolIs this recoverable?
suggested_action: Option<SuggestedAction>Suggested action for recovery
Implementations§
Source§impl SisterError
impl SisterError
Sourcepub fn with_context(self, key: impl Into<String>, value: impl Serialize) -> Self
pub fn with_context(self, key: impl Into<String>, value: impl Serialize) -> Self
Add context to the error
Sourcepub fn recoverable(self, recoverable: bool) -> Self
pub fn recoverable(self, recoverable: bool) -> Self
Set recoverable flag
Sourcepub fn with_suggestion(self, action: SuggestedAction) -> Self
pub fn with_suggestion(self, action: SuggestedAction) -> Self
Set suggested action
Sourcepub fn with_severity(self, severity: Severity) -> Self
pub fn with_severity(self, severity: Severity) -> Self
Set severity
Sourcepub fn to_mcp_message(&self) -> String
pub fn to_mcp_message(&self) -> String
Format as an MCP-friendly error message.
Includes what went wrong AND what to try instead, so the LLM can reason about recovery.
Sourcepub fn invalid_input(message: impl Into<String>) -> Self
pub fn invalid_input(message: impl Into<String>) -> Self
Invalid input error
Sourcepub fn permission_denied(message: impl Into<String>) -> Self
pub fn permission_denied(message: impl Into<String>) -> Self
Permission denied error
Sourcepub fn context_not_found(context_id: impl Into<String>) -> Self
pub fn context_not_found(context_id: impl Into<String>) -> Self
Context/session not found error
Sourcepub fn evidence_not_found(evidence_id: impl Into<String>) -> Self
pub fn evidence_not_found(evidence_id: impl Into<String>) -> Self
Evidence not found error
Trait Implementations§
Source§impl Clone for SisterError
impl Clone for SisterError
Source§fn clone(&self) -> SisterError
fn clone(&self) -> SisterError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SisterError
impl Debug for SisterError
Source§impl Default for SisterError
impl Default for SisterError
Source§impl<'de> Deserialize<'de> for SisterError
impl<'de> Deserialize<'de> for SisterError
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for SisterError
impl Display for SisterError
Source§impl Error for SisterError
impl Error for SisterError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<Error> for SisterError
impl From<Error> for SisterError
Source§impl From<Error> for SisterError
impl From<Error> for SisterError
Auto Trait Implementations§
impl Freeze for SisterError
impl RefUnwindSafe for SisterError
impl Send for SisterError
impl Sync for SisterError
impl Unpin for SisterError
impl UnsafeUnpin for SisterError
impl UnwindSafe for SisterError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more