Weavr.Error (Weavr v1.0.0)

Copy Markdown View Source

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

t()

Any error type that this library can return.

Types

t()

Any error type that this library can return.