View Source Appwrite.Exceptions.AppwriteException exception (appwrite v0.2.1)

Represents an error returned by the Appwrite API or the HTTP layer.

Fields

  • message – Human-readable description of the error.
  • code – HTTP status code (0 for network-level errors).
  • type – Appwrite error type string (e.g. "user_not_found").
  • response – The raw decoded response body map, or nil.

Usage

iex> AppwriteException.new("Not found", 404, "document_not_found", %{})
%AppwriteException{message: "Not found", code: 404, type: "document_not_found", response: %{}}

# Raise directly
raise AppwriteException, message: "Unauthorized", code: 401, type: "user_unauthorized"

Summary

Types

t()

@type t() :: %Appwrite.Exceptions.AppwriteException{
  __exception__: true,
  code: non_neg_integer(),
  message: String.t(),
  response: map() | nil,
  type: String.t()
}

Functions

new(message \\ "An error occurred", code \\ 0, type \\ "unknown", response \\ nil)

@spec new(String.t(), non_neg_integer(), String.t(), any()) :: t()

Builds a new AppwriteException struct.

Parameters

  • message – Error message string. Defaults to "An error occurred".
  • code – HTTP status code. Defaults to 0.
  • type – Appwrite error type. Defaults to "unknown".
  • response – Raw response body. Defaults to nil.