Base behaviour and shared shape for all errors raised or returned by
Weavr.
Every error struct in this library implements Exception (so it can
be raised with raise/1 when using the ! function variants) and
carries a consistent set of fields so callers can pattern-match
generically:
case Weavr.Accounts.get(client, id) do
{:ok, account} -> account
{:error, %Weavr.Error.API{status: 404}} -> nil
{:error, %Weavr.Error.API{status: 401}} -> reauthenticate()
{:error, %Weavr.Error.Network{}} -> retry_later()
end
Summary
Types
@type t() :: Weavr.Error.API.t() | Weavr.Error.Network.t() | Weavr.Error.Timeout.t() | Weavr.Error.InvalidRequest.t() | Weavr.Error.Decode.t()
Any error type that this library can return.