Sha256: 2f2055af5d60096bcd7f0d2bc698a087611febdb0e24c7effed3b2f5d8b280b2
Contents?: true
Size: 842 Bytes
Versions: 1
Compression:
Stored size: 842 Bytes
Contents
module Exceptron class Middleware def initialize(app, consider_all_requests_local) @app = app @dispatcher = Dispatcher.new(consider_all_requests_local) end def call(env) begin status, headers, body = @app.call(env) exception = nil # Only this middleware cares about RoutingError. So, let's just raise # it here. if headers['X-Cascade'] == 'pass' raise ActionController::RoutingError, "No route matches [#{env['REQUEST_METHOD']}] #{env['PATH_INFO'].inspect}" end rescue Exception => exception raise exception unless Exceptron.enabled? exception = Presenter.new(exception) env["exceptron.presenter"] = exception end exception ? @dispatcher.dispatch(env, exception) : [status, headers, body] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
exceptron-0.0.2 | lib/exceptron/middleware.rb |