DalaDev.Error (dala_dev v0.1.1)

Copy Markdown View Source

Standardized error handling for the dala_dev codebase.

Provides consistent error types and helper functions to ensure uniform error reporting across all modules.

Summary

Functions

Formats an error for user-friendly display.

Creates a standardized error tuple with optional module context.

Wraps a function call with standardized error handling.

Types

t()

@type t() :: {:error, reason :: term()} | {:error, module :: atom(), reason :: term()}

Functions

format(arg)

@spec format({:error, term()}) :: String.t()

Formats an error for user-friendly display.

new(reason)

@spec new(term()) :: {:error, term()}

Creates a standardized error tuple with optional module context.

new(module, reason)

@spec new(atom(), term()) :: {:error, atom(), term()}

wrap(context, fun)

@spec wrap(term(), (-> {:ok, term()} | {:error, term()})) ::
  {:ok, term()} | {:error, term()}

Wraps a function call with standardized error handling.