Class: Rack::ErrorPage
- Inherits:
-
Object
- Object
- Rack::ErrorPage
- Defined in:
- lib/rack_errorpage.rb
Overview
Catches all exceptions, forgets about them, and displays the given html file wth a status of 500
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, filename) ⇒ ErrorPage
constructor
A new instance of ErrorPage.
Constructor Details
#initialize(app, filename) ⇒ ErrorPage
Returns a new instance of ErrorPage.
11 12 13 14 |
# File 'lib/rack_errorpage.rb', line 11 def initialize(app,filename) @app = app @filename = filename end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
9 10 11 |
# File 'lib/rack_errorpage.rb', line 9 def filename @filename end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rack_errorpage.rb', line 16 def call(env) status, headers, body = begin @app.call(env) rescue => boom render_page end render_page if env['rack.exception'] [status, headers, body] end |