PropertyDamage.Error (PropertyDamage v0.2.0)

View Source

User-friendly error formatting and common error types.

This module provides helpful error messages that guide users toward fixing problems rather than just reporting them.

Summary

Functions

Formats an error reason into a user-friendly message.

Formats a configuration error with suggestions.

Formats a warning with context.

Types

error_context()

@type error_context() :: %{
  optional(:command) => struct(),
  optional(:command_index) => non_neg_integer(),
  optional(:check_name) => atom(),
  optional(:projection) => module(),
  optional(:adapter) => module(),
  optional(:model) => module(),
  optional(:seed) => integer()
}

Functions

format(reason, context \\ %{})

@spec format(term(), error_context()) :: String.t()

Formats an error reason into a user-friendly message.

Takes the raw error reason from execution and returns a formatted string with context and suggestions for fixing the issue.

format_config_error(type, value)

@spec format_config_error(atom(), term()) :: String.t()

Formats a configuration error with suggestions.

format_warning(type, command)

@spec format_warning(atom(), term()) :: String.t()

Formats a warning with context.