/usr/lib/ruby/1.8/vendor/route_exceptions.rb is in libramaze-ruby1.8 2010.06.18-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | module Rack
class RouteExceptions
ROUTES = []
PATH_INFO = 'rack.route_exceptions.path_info'.freeze
EXCEPTION = 'rack.route_exceptions.exception'.freeze
class << self
def route(exception, to)
ROUTES.delete_if{|k,v| k == exception }
ROUTES << [exception, to]
end
alias []= route
end
def initialize(app)
@app = app
end
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
def route(to, env, exception)
env.merge!(
PATH_INFO => env['PATH_INFO'],
EXCEPTION => exception,
'PATH_INFO' => to)
call(env, try_again = false)
end
end
end
|