Class: Rack::RouteExceptions
- Inherits:
-
Object
- Object
- Rack::RouteExceptions
- Defined in:
- lib/vendor/route_exceptions.rb
Constant Summary collapse
- ROUTES =
[]
- PATH_INFO =
'rack.route_exceptions.path_info'.freeze
- EXCEPTION =
'rack.route_exceptions.exception'.freeze
Class Method Summary collapse
Instance Method Summary collapse
- #call(env, try_again = true) ⇒ Object
-
#initialize(app) ⇒ RouteExceptions
constructor
A new instance of RouteExceptions.
- #route(to, env, exception) ⇒ Object
Constructor Details
#initialize(app) ⇒ RouteExceptions
Returns a new instance of RouteExceptions.
17 18 19 |
# File 'lib/vendor/route_exceptions.rb', line 17 def initialize(app) @app = app end |
Class Method Details
Instance Method Details
#call(env, try_again = true) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/vendor/route_exceptions.rb', line 21 def call(env, try_again = true) @app.call(env) rescue Exception => exception raise(exception) unless try_again ROUTES.each do |klass, to| next unless klass === exception return route(to, env, exception) end raise(exception) end |