# `EctoLibSql.Error`
[🔗](https://github.com/ocean/ecto_libsql/blob/v0.9.1/lib/ecto_libsql/error.ex#L1)

Exception raised when a LibSQL database operation fails.

This exception contains detailed error information from the underlying
LibSQL/SQLite database, including constraint violation details.

## Fields

- `:message` - Human-readable error message
- `:sqlite` - Map containing SQLite-specific error details (`:code`, `:message`)

# `t`

```elixir
@type t() :: %EctoLibSql.Error{
  __exception__: true,
  message: String.t(),
  sqlite: %{code: atom(), message: String.t()}
}
```

# `constraint_name`

Extracts the constraint field name from an error message.

Returns the field name if a constraint violation pattern is found,
`nil` otherwise.

## Examples

    iex> error = %EctoLibSql.Error{message: "constraint failed: users.email"}
    iex> EctoLibSql.Error.constraint_name(error)
    "email"

# `constraint_violation?`

Checks if the error is a constraint violation.

Returns `true` if the error message indicates a constraint failure,
`false` otherwise.

## Examples

    iex> error = %EctoLibSql.Error{message: "constraint failed: users.email"}
    iex> EctoLibSql.Error.constraint_violation?(error)
    true

---

*Consult [api-reference.md](api-reference.md) for complete listing*
