AshScylla.Error.ScyllaError (AshScylla v0.1.1)

Copy Markdown View Source

Comprehensive error handling for ScyllaDB-specific errors.

This module provides structured error types for ScyllaDB/Cassandra errors, user-friendly error messages, and suggestions for resolving common issues.

Error Categories

  • Connection Errors: Issues connecting to ScyllaDB nodes
  • Query Errors: Invalid CQL syntax, type mismatches
  • Consistency Errors: Write/read consistency failures
  • Schema Errors: Table, keyspace, or column not found
  • Rate Limiting: Overloaded nodes, timeout errors
  • Configuration Errors: Invalid configuration options

Usage

case repo.query(query, params) do
  {:ok, result} ->
    {:ok, result}

  {:error, %Xandra.Error{} = error} ->
    {:error, AshScylla.Error.ScyllaError.from_xandra_error(error)}

  {:error, %Xandra.ConnectionError{} = error} ->
    {:error, AshScylla.Error.ScyllaError.from_xandra_connection_error(error)}
end

Summary

Functions

Creates a ScyllaError from a generic error.

Creates a ScyllaError from a Xandra.ConnectionError.

Creates a ScyllaError from a Xandra.Error.

Converts the error to a human-readable string.

Types

t()

@type t() :: %AshScylla.Error.ScyllaError{
  message: String.t(),
  original_error: term(),
  query: String.t() | nil,
  reason: term(),
  suggestion: String.t() | nil,
  type: atom()
}

Functions

from_error(error)

Creates a ScyllaError from a generic error.

from_xandra_connection_error(error)

Creates a ScyllaError from a Xandra.ConnectionError.

from_xandra_error(error)

Creates a ScyllaError from a Xandra.Error.

to_string(error)

Converts the error to a human-readable string.