CalDAVEx.Error (CalDAVEx v0.1.3)

Copy Markdown View Source

Error types and utilities for CalDAV operations.

All CalDAVEx functions return errors as {:error, %CalDAVEx.Error{}}.

Summary

Types

t()

Error struct.

Functions

Creates a conflict error (HTTP 409)

Creates an HTTP error with status code and response body

Creates a not found error (HTTP 404)

Creates a CalDAV protocol error

Converts an error to a human-readable string.

Creates a transport error (network/connection issues)

Creates an unauthorized error (HTTP 401)

Creates an XML parsing error

Types

t()

@type t() :: %CalDAVEx.Error{
  details: String.t() | nil,
  message: String.t() | nil,
  type: atom()
}

Error struct.

Fields

  • type - The error type (:transport, :http, :xml, :protocol, :not_found, :unauthorized, :conflict)
  • message - Human-readable error message
  • details - Additional error details (optional)

Functions

conflict()

Creates a conflict error (HTTP 409)

http(status, body)

Creates an HTTP error with status code and response body

not_found()

Creates a not found error (HTTP 404)

protocol(msg)

Creates a CalDAV protocol error

to_string(e)

Converts an error to a human-readable string.

Examples

error = CalDAVEx.Error.http(404, "Not found")
CalDAVEx.Error.to_string(error)
# => "[caldav_ex] HTTP error: HTTP 404 - Not found"

transport(msg)

Creates a transport error (network/connection issues)

unauthorized()

Creates an unauthorized error (HTTP 401)

xml(msg)

Creates an XML parsing error