Skip to content

Commit

Permalink
insert airbrake rails middleware after better errors middleware if be…
Browse files Browse the repository at this point in the history
…tter errors middleware defined
  • Loading branch information
shifi committed Jun 12, 2015
1 parent 6b444d9 commit 5d66e27
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib/airbrake/railtie.rb
Expand Up @@ -12,13 +12,16 @@ class Railtie < ::Rails::Railtie

initializer "airbrake.middleware" do |app|

middleware = if defined?(ActionDispatch::DebugExceptions)
# Rails >= 3.2.0
"ActionDispatch::DebugExceptions"
else
# Rails < 3.2.0
"ActionDispatch::ShowExceptions"
end
middleware =
if !::Rails.env.production? && defined?(::BetterErrors::Middleware)
"BetterErrors::Middleware"
elsif defined?(::ActionDispatch::DebugExceptions)
# Rails >= 3.2.0
"ActionDispatch::DebugExceptions"
else
# Rails < 3.2.0
"ActionDispatch::ShowExceptions"
end

app.config.middleware.insert_after middleware,
"Airbrake::Rails::Middleware"
Expand Down

0 comments on commit 5d66e27

Please sign in to comment.