Class: ExceptionViewer

Inherits:
Object show all
Defined in:
lib/laris/exception_viewer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ ExceptionViewer

Returns a new instance of ExceptionViewer.



4
5
6
7
8
# File 'lib/laris/exception_viewer.rb', line 4

def initialize(app)
  @app = app
  @res = Rack::Response.new
  @exception = nil
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



2
3
4
# File 'lib/laris/exception_viewer.rb', line 2

def app
  @app
end

#exceptionObject (readonly)

Returns the value of attribute exception.



2
3
4
# File 'lib/laris/exception_viewer.rb', line 2

def exception
  @exception
end

#resObject (readonly)

Returns the value of attribute res.



2
3
4
# File 'lib/laris/exception_viewer.rb', line 2

def res
  @res
end

Instance Method Details

#call(env) ⇒ Object



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

def call(env)
  begin
    app.call(env)
  rescue => e
    @exception = e
    exception_page
  end
end