Guava.Error exception (Guava v0.34.0)

Copy Markdown View Source

The single error type raised/returned across the SDK.

Public functions come in two forms: the primary returns {:ok, result} | {:error, %Guava.Error{}}, and a ! variant raises this exception. Use wrap/1 to turn a raising call into a tagged tuple.

:type is one of:

  • :http — a non-2xx HTTP response (:status, :body populated)
  • :auth — no credentials could be resolved
  • :transport — a network/transport failure
  • :closed — a realtime socket closed
  • :unknown — anything else

Summary

Functions

Run fun, returning {:ok, result}; if it raises a Guava.Error, return {:error, error}. Other exceptions propagate.

Types

t()

@type t() :: %Guava.Error{
  __exception__: true,
  body: String.t() | nil,
  message: String.t(),
  status: pos_integer() | nil,
  type: :http | :auth | :transport | :closed | :unknown,
  url: String.t() | nil
}

Functions

wrap(fun)

@spec wrap((-> result)) :: {:ok, result} | {:error, t()} when result: var

Run fun, returning {:ok, result}; if it raises a Guava.Error, return {:error, error}. Other exceptions propagate.