Skip to content

Instantly share code, notes, and snippets.

@JoshAshby
Created January 23, 2015 23:46
Show Gist options
  • Save JoshAshby/7f7c01fcb77080635a26 to your computer and use it in GitHub Desktop.
Save JoshAshby/7f7c01fcb77080635a26 to your computer and use it in GitHub Desktop.
module Exceptatron
class Middleware
def initialize app
@app = app
end
def call request
raise StandardError.new "Bubbling down"
code, headers, body = @app.call request
raise StandardError.new "Bubbling up"
[code, headers, body]
end
end
end
Rails.application.middleware.insert_before Rack::Lock, Exceptatron::Middleware
Rails.application.middleware.insert_after Rack::Lock, Exceptatron::Middleware
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment