@@ -626,6 +626,46 @@ def report_result(self) -> None:
626626 # Optionally filter out UNCHANGED/SKIP in results for noise reduction
627627 # For now, show all for transparency
628628 print (self ._format_consequence (child , use_result_tense = True , indent = 4 ))
629+
630+ def report_error (self , summary : str , details : Optional [List [str ]] = None ) -> None :
631+ """Report execution failure with structured details.
632+
633+ Prints error message with [ERROR] prefix in bright red color (when colors enabled).
634+ Details are indented with 2 spaces for visual hierarchy.
635+
636+ Reference: R13 §4.2.3 (13-error_message_formatting_v0.md)
637+
638+ Args:
639+ summary: High-level error description
640+ details: Optional list of detail lines to print below summary
641+
642+ Output format:
643+ [ERROR] <summary>
644+ <detail_line_1>
645+ <detail_line_2>
646+
647+ Example:
648+ >>> reporter = ResultReporter("hatch env create")
649+ >>> reporter.report_error(
650+ ... "Failed to create environment 'dev'",
651+ ... details=["Python environment creation failed: conda not available"]
652+ ... )
653+ [ERROR] Failed to create environment 'dev'
654+ Python environment creation failed: conda not available
655+ """
656+ if not summary :
657+ return
658+
659+ # Print error header with color
660+ if _colors_enabled ():
661+ print (f"{ Color .RED .value } [ERROR]{ Color .RESET .value } { summary } " )
662+ else :
663+ print (f"[ERROR] { summary } " )
664+
665+ # Print details with indentation
666+ if details :
667+ for detail in details :
668+ print (f" { detail } " )
629669
630670
631671# =============================================================================
0 commit comments