Class: Aidp::Harness::UI::ErrorHandler
- Inherits:
-
Object
- Object
- Aidp::Harness::UI::ErrorHandler
show all
- Defined in:
- lib/aidp/harness/ui/error_handler.rb
Overview
Centralized error handling for UI components
Defined Under Namespace
Classes: ComponentError, DisplayError, InteractionError, UIError, ValidationError
Instance Method Summary
collapse
Constructor Details
#initialize(ui_components = {}) ⇒ ErrorHandler
Returns a new instance of ErrorHandler.
21
22
23
24
25
|
# File 'lib/aidp/harness/ui/error_handler.rb', line 21
def initialize(ui_components = {})
@logger = ui_components[:logger] || default_logger
@formatter = ui_components[:formatter] || ErrorFormatter.new
@prompt = ui_components[:prompt] || TTY::Prompt.new
end
|
Instance Method Details
#handle_component_error(error, component_name = nil) ⇒ Object
47
48
49
50
|
# File 'lib/aidp/harness/ui/error_handler.rb', line 47
def handle_component_error(error, component_name = nil)
message = @formatter.format_component_error(error, component_name)
display_user_friendly_error(message)
end
|
#handle_display_error(error, component_name = nil) ⇒ Object
37
38
39
40
|
# File 'lib/aidp/harness/ui/error_handler.rb', line 37
def handle_display_error(error, component_name = nil)
message = @formatter.format_display_error(error, component_name)
display_user_friendly_error(message)
end
|
#handle_error(error, context = {}) ⇒ Object
27
28
29
30
|
# File 'lib/aidp/harness/ui/error_handler.rb', line 27
def handle_error(error, context = {})
log_error(error, context)
display_error(error, context)
end
|
#handle_interaction_error(error, interaction_type = nil) ⇒ Object
42
43
44
45
|
# File 'lib/aidp/harness/ui/error_handler.rb', line 42
def handle_interaction_error(error, interaction_type = nil)
message = @formatter.format_interaction_error(error, interaction_type)
display_user_friendly_error(message)
end
|
#handle_validation_error(error, field_name = nil) ⇒ Object
32
33
34
35
|
# File 'lib/aidp/harness/ui/error_handler.rb', line 32
def handle_validation_error(error, field_name = nil)
message = @formatter.format_validation_error(error, field_name)
display_user_friendly_error(message)
end
|