ic-asset 0.29.0

Library for storing files in an asset canister.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use ic_agent::AgentError;
use ic_agent::export::reqwest::StatusCode;

pub(crate) fn retryable(agent_error: &AgentError) -> bool {
    match agent_error {
        AgentError::TimeoutWaitingForResponse() => true,
        AgentError::TransportError(_) => true,
        AgentError::HttpError(http_error) => {
            http_error.status == StatusCode::INTERNAL_SERVER_ERROR
                || http_error.status == StatusCode::BAD_GATEWAY
                || http_error.status == StatusCode::SERVICE_UNAVAILABLE
                || http_error.status == StatusCode::GATEWAY_TIMEOUT
                || http_error.status == StatusCode::TOO_MANY_REQUESTS
        }
        _ => false,
    }
}