scrapfly_sdk::error

Function from_response

Source
pub fn from_response(
    status: u16,
    body: &[u8],
    retry_after_ms: u64,
    is_crawler: bool,
) -> ScrapflyError
Expand description

Build a ScrapflyError from a non-2xx HTTP response.

Ports the switch logic from sdk/go/client.go::handleAPIErrorResponse + sdk/go/crawler.go::handleCrawlerErrorResponse: categorizes the error based on HTTP status + code field in the JSON envelope, surfaces the right sentinel variant, attaches a contextual hint, and parses Retry-After.