pub enum Error {
Show 13 variants
Config(String),
Session(String),
SessionNotFound {
path: String,
},
Provider {
provider: String,
message: String,
},
Auth(String),
Tool {
tool: String,
message: String,
},
Validation(String),
Extension(String),
Io(Box<Error>),
Json(Box<Error>),
Sqlite(Box<Error>),
Aborted,
Api(String),
}Expand description
Main error type for the Pi application.
Variants§
Config(String)
Configuration errors
Session(String)
Session errors
SessionNotFound
Session not found
Provider
Provider/API errors
Auth(String)
Authentication errors
Tool
Tool execution errors
Validation(String)
Validation errors
Extension(String)
Extension errors
Io(Box<Error>)
IO errors
Json(Box<Error>)
JSON errors
Sqlite(Box<Error>)
SQLite errors
Aborted
User aborted operation
Api(String)
API errors (generic)
Implementations§
Source§impl Error
impl Error
Sourcepub fn provider(provider: impl Into<String>, message: impl Into<String>) -> Self
pub fn provider(provider: impl Into<String>, message: impl Into<String>) -> Self
Create a provider error.
Sourcepub fn validation(message: impl Into<String>) -> Self
pub fn validation(message: impl Into<String>) -> Self
Create a validation error.
Sourcepub fn sse(err: &Error) -> Self
pub fn sse(err: &Error) -> Self
Build the user-facing error for an I/O failure that terminated a streaming (SSE) response read.
Retryability is decided here — at the source — from the typed
std::io::ErrorKind, because this is the last place the kind is
available: the caller immediately flattens the returned error into a
message string (AssistantMessage::error_message) that the retry loop
consults. For a transient connection drop (reset/abort/EOF/broken
pipe/timeout) a canonical transient connection drop marker is appended
so the drop is re-driven regardless of the dependency’s (rustls/hyper)
prose, which changes phrasing between versions (pi_agent_rust#118).
Sourcepub fn is_transient(&self) -> bool
pub fn is_transient(&self) -> bool
Whether this error is a transient transport failure that is safe to retry, classified from the typed error rather than its flattened message string.
Walks the std::error::Error::source chain (and, for
std::io::Error links, the std::io::Error::get_ref chain, which
source deliberately skips) looking for an std::io::Error whose
std::io::ErrorKind denotes a connection drop. This catches typed
I/O failures (e.g. an UnexpectedEof mid-body that propagates as
Error::Io) without depending on any substring match. Message-only
transient cases (dependency prose with no typed cause) are handled by
[is_retryable_error] as a documented fallback.
Sourcepub const fn hostcall_error_code(&self) -> &'static str
pub const fn hostcall_error_code(&self) -> &'static str
Map this error to a hostcall taxonomy code.
The hostcall ABI requires every error to be one of:
timeout, denied, io, invalid_request, or internal.
Sourcepub const fn category_code(&self) -> &'static str
pub const fn category_code(&self) -> &'static str
Stable machine-readable error category for automation and diagnostics.
Sourcepub fn auth_diagnostic(&self) -> Option<AuthDiagnostic>
pub fn auth_diagnostic(&self) -> Option<AuthDiagnostic>
Classify auth/config errors into stable machine-readable diagnostics.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
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> 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>
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>
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 moreimpl<T> ParallelSend for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Send for Twhere
T: ?Sized,
impl<T> Sync for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more