pub struct ApiCallErrorBuilder { /* private fields */ }Expand description
Builder for API call errors with optional fields.
Returned by ProviderError::api_call_builder. Methods are chainable;
call Self::build to finalize.
Implementations§
Source§impl ApiCallErrorBuilder
impl ApiCallErrorBuilder
Sourcepub fn status_code(self, code: u16) -> Self
pub fn status_code(self, code: u16) -> Self
Set the HTTP status code.
Sourcepub fn response_body(self, body: impl Into<String>) -> Self
pub fn response_body(self, body: impl Into<String>) -> Self
Set the response body.
Sourcepub fn response_headers(self, headers: HashMap<String, String>) -> Self
pub fn response_headers(self, headers: HashMap<String, String>) -> Self
Set the response headers.
Sourcepub fn request_body(self, body: JsonValue) -> Self
pub fn request_body(self, body: JsonValue) -> Self
Set the request body that was sent (for telemetry).
Sourcepub fn retryable(self, retryable: bool) -> Self
pub fn retryable(self, retryable: bool) -> Self
Override the auto-derived retry flag.
Without this call, retryable defaults to true for status 408 / 409 /
429 / 5xx (matching @ai-sdk/provider).
Sourcepub fn build(self) -> ProviderError
pub fn build(self) -> ProviderError
Finalize the error.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ApiCallErrorBuilder
impl !RefUnwindSafe for ApiCallErrorBuilder
impl Send for ApiCallErrorBuilder
impl Sync for ApiCallErrorBuilder
impl Unpin for ApiCallErrorBuilder
impl UnsafeUnpin for ApiCallErrorBuilder
impl !UnwindSafe for ApiCallErrorBuilder
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