Class: Dev2func::WatchDog

Inherits:
Object
  • Object
show all
Defined in:
lib/dev2func/rails/watch_dog.rb

Overview

module Rack

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ WatchDog

Returns a new instance of WatchDog.



7
8
9
# File 'lib/dev2func/rails/watch_dog.rb', line 7

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/dev2func/rails/watch_dog.rb', line 11

def call(env)
  Rails.logger.info "[Dev2func] Capture exception from caller"
  begin

    # Xray.new.scan(env)

    response = @app.call(env)

    Rails.logger.info "[Dev2func] Response..... #{response}"

    # At the moment only useful for backend exception
    Sherif.new.xray(response, env)


    response
  rescue Exception => e
    Rails.logger.info "[Dev2Func] Exception #{e.message}"
    raise
    # exception_message = e.message if e.respond_to?(:message)
    # exception_message ||= 'No Exception Message'
  end
end