Pipeline.Error.NestedPipeline (pipeline v0.0.1)
View SourceEnhanced error formatting and context tracking for nested pipeline execution.
Provides comprehensive error messages with full execution stack traces, pipeline hierarchy, and relevant context information for debugging nested pipeline failures.
Summary
Functions
Create a structured error log entry for debugging.
Format a circular dependency error with the detected cycle.
Format a nested pipeline error with comprehensive context information.
Format a resource limit error with current usage information.
Format a timeout error with execution context.
Types
@type debug_log_entry() :: %{ timestamp: DateTime.t(), error_type: error_type(), error_message: String.t(), pipeline_id: String.t(), nesting_depth: non_neg_integer(), step_name: String.t() | nil, step_type: String.t() | nil, execution_chain: [String.t(), ...], total_steps: non_neg_integer(), elapsed_ms: integer(), context_summary: %{ context_size: non_neg_integer(), has_parent: boolean(), key_count: non_neg_integer(), nesting_depth: non_neg_integer() }, step_config: map() | nil }
@type error_context() :: %{ pipeline_id: String.t(), step_name: String.t() | nil, nesting_depth: non_neg_integer(), execution_chain: [String.t()], start_time: DateTime.t(), elapsed_ms: non_neg_integer(), total_steps: non_neg_integer(), step_index: non_neg_integer() | nil, parent_context: error_context() | nil }
@type error_type() ::
:circular_dependency
| :not_found
| :resource_limit
| :timeout
| :unknown
| :validation
@type formatted_error() :: %{ message: String.t(), context: error_context(), stack_trace: [String.t()], hierarchy: String.t(), debug_info: map() }
Functions
@spec create_debug_log_entry(any(), map()) :: debug_log_entry()
Create a structured error log entry for debugging.
Parameters
error
: The error that occurredcontext
: Current execution contextstep
: Current step configuration (optional)
Returns
- Structured log entry map
@spec create_debug_log_entry(any(), map(), map() | nil) :: debug_log_entry()
Format a circular dependency error with the detected cycle.
Parameters
circular_chain
: List of pipeline IDs forming the circular dependencycontext
: Current execution context
Returns
- Formatted circular dependency error message
@spec format_nested_error(any(), map(), map() | nil) :: formatted_error()
Format a nested pipeline error with comprehensive context information.
Parameters
error
: The original error (string, exception, or error tuple)context
: Current execution contextstep
: Current step configuration (optional)
Returns
- Formatted error with full context information
Examples
iex> context = %{nesting_depth: 1, pipeline_id: "child", parent_context: %{pipeline_id: "parent", nesting_depth: 0}}
iex> formatted = Pipeline.Error.NestedPipeline.format_nested_error("API timeout", context)
iex> String.contains?(formatted.message, "parent → child")
true
Format a resource limit error with current usage information.
Parameters
limit_type
: Type of limit exceeded (:memory, :depth, :steps)current_value
: Current resource usagelimit_value
: The limit that was exceededcontext
: Current execution context
Returns
- Formatted resource limit error message
@spec format_timeout_error(non_neg_integer(), map(), non_neg_integer()) :: String.t()
Format a timeout error with execution context.
Parameters
timeout_seconds
: The timeout that was exceededcontext
: Current execution contextelapsed_ms
: Actual elapsed time in milliseconds
Returns
- Formatted timeout error message