View Source Synq.Error (synq v0.2.0)

Standardized error structure for Synq applications.

Core fields:

  • code: Unique identifier (e.g., "AUTH001", "VAL002")
  • message: Human-readable description
  • details: Optional context/debugging info

Summary

Functions

Creates a new error struct.

Converts any error term into a standardized Synq.Error struct.

Types

@type t() :: %Synq.Error{
  code: String.t(),
  details: map() | nil,
  message: String.t(),
  timestamp: DateTime.t()
}

Functions

Link to this function

new(code, message, details \\ nil)

View Source
@spec new(String.t(), String.t(), map() | nil) :: t()

Creates a new error struct.

Examples

iex> Synq.Error.new("AUTH001", "Invalid credentials")
%Synq.Error{
  code: "AUTH001",
  message: "Invalid credentials",
  details: nil,
  timestamp: ~U[2023-...]
}
@spec normalize(term()) :: t()

Converts any error term into a standardized Synq.Error struct.