internetdata_error (internetdata v1.0.0)

View Source

Why a request failed, and whether trying it again could ever help.

Summary

Functions

Classify a non-2xx response.

Classify a failure that never produced a response at all.

Types

error/0

-type error() ::
          #{kind := kind(),
            message := binary(),
            retryable := boolean(),
            status => 100..599,
            retry_after => non_neg_integer()}.

kind/0

-type kind() ::
          bad_request | unauthorized | forbidden | rate_limited | quota_exceeded | server_error |
          network | io.

Functions

from_response(Status, Headers, Body)

-spec from_response(100..599, [{binary(), binary()}], binary()) -> error().

Classify a non-2xx response.

from_transport(Reason)

-spec from_transport(term()) -> error().

Classify a failure that never produced a response at all.