REGRESSION: exceptions are handled natively by logster
This commit is contained in:
parent
9d3c7f4a52
commit
71d6266f98
|
@ -59,20 +59,6 @@ class ApplicationController < ActionController::Base
|
||||||
use_crawler_layout? ? 'crawler' : 'application'
|
use_crawler_layout? ? 'crawler' : 'application'
|
||||||
end
|
end
|
||||||
|
|
||||||
rescue_from Exception do |exception|
|
|
||||||
unless [ActiveRecord::RecordNotFound,
|
|
||||||
ActionController::RoutingError,
|
|
||||||
ActionController::UnknownController,
|
|
||||||
AbstractController::ActionNotFound].include? exception.class
|
|
||||||
begin
|
|
||||||
Discourse.handle_request_exception(exception, self, request, current_user)
|
|
||||||
rescue
|
|
||||||
# dont care give up
|
|
||||||
end
|
|
||||||
end
|
|
||||||
raise
|
|
||||||
end
|
|
||||||
|
|
||||||
# Some exceptions
|
# Some exceptions
|
||||||
class RenderEmpty < Exception; end
|
class RenderEmpty < Exception; end
|
||||||
|
|
||||||
|
|
|
@ -26,29 +26,6 @@ module Discourse
|
||||||
}.merge(context))
|
}.merge(context))
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.handle_request_exception(ex, controller, request, current_user)
|
|
||||||
cm = RailsMultisite::ConnectionManagement
|
|
||||||
context = {
|
|
||||||
current_db: cm.current_db,
|
|
||||||
current_hostname: cm.current_hostname,
|
|
||||||
rails_action: controller.action_name,
|
|
||||||
rails_controller: controller.controller_name,
|
|
||||||
}
|
|
||||||
|
|
||||||
env = request.env.dup
|
|
||||||
|
|
||||||
context.each do |key, value|
|
|
||||||
Logster.add_to_env(env, key, value)
|
|
||||||
end
|
|
||||||
|
|
||||||
begin
|
|
||||||
Thread.current[Logster::Logger::LOGSTER_ENV] = env
|
|
||||||
Logster.logger.fatal("#{ex.class.to_s}: #{ex.message} in #{controller.controller_name}##{controller.action_name}")
|
|
||||||
ensure
|
|
||||||
Thread.current[Logster::Logger::LOGSTER_ENV] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Expected less matches than what we got in a find
|
# Expected less matches than what we got in a find
|
||||||
class TooManyMatches < Exception; end
|
class TooManyMatches < Exception; end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue