Class: CapyDash::ErrorHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/capydash/error_handler.rb

Class Method Summary collapse

Class Method Details

.handle_error(error, context = {}) ⇒ Object



4
5
6
7
8
# File 'lib/capydash/error_handler.rb', line 4

def handle_error(error, context = {})
  log_error(error, context)
  notify_error(error, context) if should_notify?(error)
  recover_from_error(error, context)
end

.handle_instrumentation_error(error, method_name = nil) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/capydash/error_handler.rb', line 28

def handle_instrumentation_error(error, method_name = nil)
  context = {
    error_type: 'instrumentation',
    method_name: method_name,
    error_class: error.class.name
  }
  handle_error(error, context)
end

.handle_test_execution_error(error, test_path = nil) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/capydash/error_handler.rb', line 19

def handle_test_execution_error(error, test_path = nil)
  context = {
    error_type: 'test_execution',
    test_path: test_path,
    error_class: error.class.name
  }
  handle_error(error, context)
end

.handle_websocket_error(error, connection = nil) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/capydash/error_handler.rb', line 10

def handle_websocket_error(error, connection = nil)
  context = {
    error_type: 'websocket',
    connection_id: connection&.id,
    error_class: error.class.name
  }
  handle_error(error, context)
end