Class: Aidp::Harness::UI::ErrorFormatter
- Inherits:
-
Object
- Object
- Aidp::Harness::UI::ErrorFormatter
- Defined in:
- lib/aidp/harness/ui/error_handler.rb
Overview
Formats error messages for display
Instance Method Summary collapse
- #format_component_error(error, component_name = nil) ⇒ Object
- #format_display_error(error, component_name = nil) ⇒ Object
- #format_generic_error(error) ⇒ Object
- #format_interaction_error(error, interaction_type = nil) ⇒ Object
- #format_recovery_suggestion(error_type) ⇒ Object
- #format_validation_error(error, field_name = nil) ⇒ Object
Instance Method Details
#format_component_error(error, component_name = nil) ⇒ Object
113 114 115 116 117 |
# File 'lib/aidp/harness/ui/error_handler.rb', line 113 def format_component_error(error, component_name = nil) = "Component error" component_suffix = component_name ? " in #{component_name}" : "" "#{base_message}#{component_suffix}: #{error.message}" end |
#format_display_error(error, component_name = nil) ⇒ Object
101 102 103 104 105 |
# File 'lib/aidp/harness/ui/error_handler.rb', line 101 def format_display_error(error, component_name = nil) = "Display error" component_suffix = component_name ? " in #{component_name}" : "" "#{base_message}#{component_suffix}: #{error.message}" end |
#format_generic_error(error) ⇒ Object
119 120 121 |
# File 'lib/aidp/harness/ui/error_handler.rb', line 119 def format_generic_error(error) "An unexpected error occurred: #{error.message}" end |
#format_interaction_error(error, interaction_type = nil) ⇒ Object
107 108 109 110 111 |
# File 'lib/aidp/harness/ui/error_handler.rb', line 107 def format_interaction_error(error, interaction_type = nil) = "Interaction error" type_suffix = interaction_type ? " during #{interaction_type}" : "" "#{base_message}#{type_suffix}: #{error.message}" end |
#format_recovery_suggestion(error_type) ⇒ Object
123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/aidp/harness/ui/error_handler.rb', line 123 def format_recovery_suggestion(error_type) case error_type when :validation "Please check your input and try again." when :display "The display may not render correctly. Please try again." when :interaction "Please try the interaction again." when :component "The component may not function properly. Please restart the application." else "Please try again or restart the application if the problem persists." end end |
#format_validation_error(error, field_name = nil) ⇒ Object
95 96 97 98 99 |
# File 'lib/aidp/harness/ui/error_handler.rb', line 95 def format_validation_error(error, field_name = nil) = "Validation failed" field_suffix = field_name ? " for #{field_name}" : "" "#{base_message}#{field_suffix}: #{error.message}" end |