Class: Exceptional::Catcher

Inherits:
Object
  • Object
show all
Defined in:
lib/exceptional/catcher.rb

Class Method Summary collapse

Class Method Details

.handle(exception, name = nil) ⇒ Object

unspeced



24
25
26
27
28
29
30
31
# File 'lib/exceptional/catcher.rb', line 24

def handle(exception, name=nil)
  if Config.should_send_to_api?
    data = ExceptionData.new(exception, name)
    Remote.error(data)
  else
    raise exception
  end
end

.handle_with_controller(exception, controller = nil, request = nil) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/exceptional/catcher.rb', line 4

def handle_with_controller(exception, controller=nil, request=nil)
  if Config.should_send_to_api?
    data = ControllerExceptionData.new(exception, controller, request)
    Remote.error(data)
  else
    raise exception
  end
end

.handle_with_rack(exception, environment, request) ⇒ Object

unspeced



14
15
16
17
18
19
20
21
# File 'lib/exceptional/catcher.rb', line 14

def handle_with_rack(exception, environment, request) 
  if Config.should_send_to_api?
    data = RackExceptionData.new(exception, environment, request)
    Remote.error(data)
  else
    raise exception
  end
end