Davy.Error (davy v0.4.1)

Copy Markdown View Source

WebDAV error with HTTP status code mapping.

Backend and lock store callbacks return {:error, %Davy.Error{}} to signal failures. The code atom maps to an HTTP status code via status_code/1.

code is a closed union — a code with no status_code/1 clause is a Dialyzer error rather than a silent 500 at runtime.

Summary

Functions

Returns the HTTP status code for the given error code atom.

Types

error_code()

@type error_code() ::
  :bad_gateway
  | :bad_request
  | :conflict
  | :failed_dependency
  | :forbidden
  | :insufficient_storage
  | :internal_error
  | :locked
  | :method_not_allowed
  | :not_found
  | :precondition_failed
  | :range_not_satisfiable
  | :request_entity_too_large
  | :service_unavailable
  | :unauthorized
  | :unsupported_media_type

t()

@type t() :: %Davy.Error{code: error_code(), message: String.t() | nil}

Functions

status_code(atom)

@spec status_code(error_code()) :: pos_integer()

Returns the HTTP status code for the given error code atom.