internetdata_error (internetdata v1.6.1)

View Source

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

Summary

Functions

The authorization server refusing an OAuth request: the ordinary error for its status, plus the RFC 6749 error code, and never retryable, because every code answers the request as it was made.

Classify a non-2xx response.

Classify a failure that never produced a response at all.

A device-code poll reaching the code's lifetime before the server said so: coded expired_token, and without a status, which is how it is told apart.

Types

error/0

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

kind/0

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

Functions

from_oauth(Status, Headers, Code, Description)

-spec from_oauth(400..499, [{binary(), binary()}], binary(), binary() | undefined) -> error().

The authorization server refusing an OAuth request: the ordinary error for its status, plus the RFC 6749 error code, and never retryable, because every code answers the request as it was made.

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.

local_expiry()

-spec local_expiry() -> error().

A device-code poll reaching the code's lifetime before the server said so: coded expired_token, and without a status, which is how it is told apart.