pub enum Error {
Http {
status: u16,
body: String,
},
Serde(Error),
Transport(Box<Error>),
Sse(Box<Error>),
}Expand description
Error type for the opencode-codes crate.
Variants§
Http
The opencode server returned a non-success HTTP status.
status is the HTTP status code; body is the (best-effort) response
body, useful for surfacing the server’s error payload.
Fields
Serde(Error)
JSON serialization or deserialization failed.
Returned when request bodies can’t be serialized or response/SSE payloads don’t match the expected shape.
Transport(Box<Error>)
A transport-level error occurred while talking to the server.
Common causes: connection refused, TLS failure, timeout, broken pipe.
Boxed because reqwest::Error embeds a reqwest::Response and is large;
boxing keeps the whole Error small enough that -> Result<T>
does not trip clippy::result_large_err.
Sse(Box<Error>)
The Server-Sent Events stream failed.
Returned when the GET /event stream errors, closes unexpectedly, or
yields a frame that cannot be decoded.
Boxed for the same size reason as Error::Transport.
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()