LightningWeb.API.Codes (Lightning v2.20.1)

Copy Markdown View Source

The API's codes: each response code with its status and fixed detail, and every code an error entry may carry. Both lists are the API's contract. Adding a code is compatible. Renaming or removing one, or moving it to another status, is a breaking change.

Summary

Types

A response code, one of the keys of the response list.

Functions

The codes the walker maps from Ecto's own options, and those Lightning sets with code:.

The code a raise is answered with. Every exception a client can cause has a 4xx status (Plug.Exception.status/1) and is answered by it. Anything else is :internal: a 500 means Lightning raised where it should not have.

The code a usage or rate limiter's refusal is answered with. The limiter's text is copy for the app's pages, so it never reaches the answer.

Every status code may answer with, its own first.

Types

code()

@type code() ::
  :id_taken
  | :insufficient_scope
  | :being_edited
  | :scheduled_for_deletion
  | :invalid_request
  | :bad_request
  | :in_use
  | :concurrent_edit
  | :invalid_token
  | :not_implemented
  | :too_many_requests
  | :malformed
  | :content_too_large
  | :not_found
  | :not_acceptable
  | :service_unavailable
  | :invalid_header
  | :uri_too_long
  | :export_conflict
  | :exceeds_limit
  | :not_ready
  | :timeout
  | :forbidden
  | :invalid
  | :trigger_disabled
  | :internal
  | :unauthenticated
  | :request_timeout
  | :bad_gateway
  | :invalid_parameter
  | :too_many_runs
  | :ambiguous_name
  | :unsupported_media_type

A response code, one of the keys of the response list.

Functions

detail(code)

@spec detail(code()) :: String.t()

entry_codes()

@spec entry_codes() :: [atom()]

The codes the walker maps from Ecto's own options, and those Lightning sets with code:.

for_exception(arg1, exception)

@spec for_exception(:error | :exit | :throw, term()) :: code()

The code a raise is answered with. Every exception a client can cause has a 4xx status (Plug.Exception.status/1) and is answered by it. Anything else is :internal: a 500 means Lightning raised where it should not have.

for_limiter(reason)

@spec for_limiter(atom()) :: code()

The code a usage or rate limiter's refusal is answered with. The limiter's text is copy for the app's pages, so it never reaches the answer.

response_codes()

@spec response_codes() :: [code()]

status(code)

@spec status(code()) :: pos_integer()

statuses(code)

@spec statuses(code()) :: [pos_integer()]

Every status code may answer with, its own first.