Skip to main content

Module errors

Module errors 

Source
Expand description

Unified error types for debtmap analysis operations (DEPRECATED).

DEPRECATED: This module’s AnalysisError type is deprecated in favor of crate::debtmap_error::DebtmapError. The types here are maintained for backwards compatibility during migration. New code should use DebtmapError.

This module provides error types that bridge between anyhow’s dynamic errors and stillwater’s structured effect system. The design allows gradual migration from anyhow to effect-based error handling while maintaining backwards compatibility.

§Migration

All types in this module implement Into<DebtmapError> for gradual migration:

use debtmap::errors::AnalysisError;
use debtmap::debtmap_error::DebtmapError;

let old_error = AnalysisError::io("Failed to read file");
let new_error: DebtmapError = old_error.into();

§Design Philosophy

  • Backwards Compatible: All existing code using anyhow::Result continues to work
  • Structured Errors: Categorized errors enable better error handling and reporting
  • Accumulation Support: Error types support stillwater’s Validation pattern for collecting ALL errors instead of failing at the first one

§Example

use debtmap::errors::AnalysisError;

// Create typed errors
let io_err = AnalysisError::io("Failed to read file");
let parse_err = AnalysisError::parse("Invalid syntax at line 42");

// Convert to/from anyhow for backwards compatibility
let anyhow_err: anyhow::Error = io_err.clone().into();
let back_to_analysis: AnalysisError = anyhow_err.into();

Re-exports§

pub use collection::AnalysisFailure;
pub use collection::AnalysisResults;
pub use collection::OperationType;
pub use partition::ParPartitionResult;
pub use partition::PartitionResult;
pub use reporting::report_brief_summary;
pub use reporting::report_completion_summary;
pub use summary::ErrorSummary as AnalysisErrorSummary;

Modules§

collection
Error collection data structures for batch operations.
partition
Helper traits for partitioning Result iterators.
reporting
Completion reporting for batch analysis operations.
summary
Error summary generation for batch operations.

Structs§

ErrorSummary
Error summary for structured output.

Enums§

AnalysisError
Unified error type for debtmap analysis operations.

Functions§

errors_to_anyhow
Convert a list of AnalysisErrors to an anyhow::Error with formatted message.
format_error_list
Format a list of errors for display.
format_error_report
Format error report for return as string (useful for testing).
group_errors_by_category
Group errors by category for structured reporting.
print_error_report
Print an error report to stderr with formatting.
print_error_report_titled
Print an error report with a custom title.
print_grouped_error_report
Print a grouped error report organized by category.