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 Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(ui_components = {}) ⇒ ErrorHandler
Returns a new instance of ErrorHandler.
24
25
26
27
28
|
# File 'lib/aidp/harness/ui/error_handler.rb', line 24
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 Attribute Details
#logger ⇒ Object
22
23
24
|
# File 'lib/aidp/harness/ui/error_handler.rb', line 22
def logger
@logger
end
|
Instance Method Details
#handle_component_error(error, component_name = nil) ⇒ Object
50
51
52
53
|
# File 'lib/aidp/harness/ui/error_handler.rb', line 50
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
40
41
42
43
|
# File 'lib/aidp/harness/ui/error_handler.rb', line 40
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
30
31
32
33
|
# File 'lib/aidp/harness/ui/error_handler.rb', line 30
def handle_error(error, context = {})
log_error(error, context)
display_error(error, context)
end
|
#handle_interaction_error(error, interaction_type = nil) ⇒ Object
45
46
47
48
|
# File 'lib/aidp/harness/ui/error_handler.rb', line 45
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
35
36
37
38
|
# File 'lib/aidp/harness/ui/error_handler.rb', line 35
def handle_validation_error(error, field_name = nil)
message = @formatter.format_validation_error(error, field_name)
display_user_friendly_error(message)
end
|