pub struct StructuredError {
pub code: ErrorCode,
pub message: String,
pub hint: Option<String>,
pub retryable: bool,
pub context: Option<Value>,
}Expand description
Structured error for machine-parseable output.
Provides AI coding agents with:
- Machine-readable error code
- Human-readable message
- Context-aware hint for self-correction
- Retryability flag
- Structured context data
Fields§
§code: ErrorCodeMachine-readable error code
message: StringHuman-readable error message
hint: Option<String>Optional hint for fixing the error
retryable: boolWhether the operation can be retried
context: Option<Value>Additional context data
Implementations§
Source§impl StructuredError
impl StructuredError
Sourcepub fn from_error(err: &BeadsError) -> Self
pub fn from_error(err: &BeadsError) -> Self
Create a new structured error from a BeadsError.
Sourcepub fn issue_not_found(searched_id: &str, existing_ids: &[String]) -> Self
pub fn issue_not_found(searched_id: &str, existing_ids: &[String]) -> Self
Create a structured error with similar ID suggestions.
Sourcepub fn ambiguous_id(partial: &str, matches: &[String]) -> Self
pub fn ambiguous_id(partial: &str, matches: &[String]) -> Self
Create a structured error for ambiguous ID.
Sourcepub fn cycle_detected(cycle_path: &str) -> Self
pub fn cycle_detected(cycle_path: &str) -> Self
Create a structured error for cycle detection.
Sourcepub fn not_initialized() -> Self
pub fn not_initialized() -> Self
Create a structured error for not initialized.
Sourcepub fn invalid_priority(provided: &str) -> Self
pub fn invalid_priority(provided: &str) -> Self
Create a structured error for invalid priority.
Sourcepub fn invalid_status(provided: &str) -> Self
pub fn invalid_status(provided: &str) -> Self
Create a structured error for invalid status.
Sourcepub fn invalid_type(provided: &str) -> Self
pub fn invalid_type(provided: &str) -> Self
Create a structured error for invalid issue type.
Trait Implementations§
Source§impl Clone for StructuredError
impl Clone for StructuredError
Source§fn clone(&self) -> StructuredError
fn clone(&self) -> StructuredError
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 StructuredError
impl Debug for StructuredError
Source§impl<'de> Deserialize<'de> for StructuredError
impl<'de> Deserialize<'de> for StructuredError
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
Auto Trait Implementations§
impl Freeze for StructuredError
impl RefUnwindSafe for StructuredError
impl Send for StructuredError
impl Sync for StructuredError
impl Unpin for StructuredError
impl UnsafeUnpin for StructuredError
impl UnwindSafe for StructuredError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more