vpndetection_error (vpndetection v3.1.0)

View Source

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

Summary

Functions

A per-entry failure inside a successful batch: the status the single lookup would have answered, and its message, with no headers at all - so a 429 here is a spent allowance, which is the only kind the API puts in an entry.

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_entry(Status, Message)

-spec from_entry(100..599, binary()) -> error().

A per-entry failure inside a successful batch: the status the single lookup would have answered, and its message, with no headers at all - so a 429 here is a spent allowance, which is the only kind the API puts in an entry.

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.