ExIncus.Error exception (ex_incus v1.0.0)

Copy Markdown

Error returned by any ExIncus function.

All API functions return {:error, %ExIncus.Error{}} on failure. The struct is also an exception, so it can be raised directly:

case ExIncus.Instances.get(client, "web1") do
  {:ok, instance} -> instance
  {:error, error} -> raise error
end

Fields

  • :message - human readable description of the error
  • :code - the Incus error code (usually mirrors the HTTP status, e.g. 404), or an operation status code (e.g. 400 for a failed background operation). nil for transport-level errors.
  • :http_status - the HTTP status of the response, if a response was received
  • :reason - the underlying cause: the transport exception (e.g. %Mint.TransportError{}), the failed ExIncus.Operation, or the raw response body

Summary

Types

t()

@type t() :: %ExIncus.Error{
  __exception__: term(),
  code: integer() | nil,
  http_status: integer() | nil,
  message: String.t(),
  reason: term()
}