Turso.Error exception (ex_turso v0.5.0)

Copy Markdown View Source

Exception raised or returned when a turso operation fails.

  • message — the reason string produced by the native layer (or by Turso itself for validation errors)
  • code — a coarse error class for programmatic handling:
    • :busy — the database is locked; the operation may be retried
    • :constraint — a constraint (UNIQUE, NOT NULL, ...) was violated
    • :io / :corrupt — the connection is unusable; the pool drops and replaces it
    • :misuse — the API was used incorrectly
    • :invalid_param — a bound parameter had an unsupported type
    • :error — any other native error
    • nil — the error originated in the Elixir layer, not the NIF

Summary

Types

code()

@type code() ::
  :busy | :constraint | :io | :corrupt | :misuse | :invalid_param | :error | nil

t()

@type t() :: %Turso.Error{__exception__: true, code: code(), message: String.t()}