pub enum Error {
Http(Error),
Api {
status: u16,
code: String,
message: String,
},
Deserialize(String),
Sse(String),
Exhausted {
attempts: u32,
source: Box<Error>,
},
}Expand description
SDK error type.
Distinguishes between network errors, API errors (with status code and structured body), and deserialization errors.
§Examples
use ironflow_sdk::Error;
let err = Error::api(404, "RUN_NOT_FOUND", "run not found");
assert!(err.is_api_error());Variants§
Http(Error)
HTTP transport error (network unreachable, DNS, TLS, timeout).
Api
The API returned an error response with a structured body.
Fields
Deserialize(String)
Failed to deserialize the response body.
Sse(String)
SSE stream error.
Exhausted
All retry attempts exhausted.
Implementations§
Source§impl Error
impl Error
Sourcepub fn api(
status: u16,
code: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn api( status: u16, code: impl Into<String>, message: impl Into<String>, ) -> Self
Create an API error from its components.
Sourcepub fn is_api_error(&self) -> bool
pub fn is_api_error(&self) -> bool
Returns true if this is an API error (not a transport error).
Sourcepub fn status(&self) -> Option<u16>
pub fn status(&self) -> Option<u16>
Returns the HTTP status code if this is an API error (or an
Exhausted wrapping one).
Sourcepub fn is_exhausted(&self) -> bool
pub fn is_exhausted(&self) -> bool
Returns true if all retry attempts were exhausted.
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)>
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()
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<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