summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorblackst0ne <blackst0ne.ru@gmail.com>2018-04-28 20:01:31 +1100
committerblackst0ne <blackst0ne.ru@gmail.com>2018-04-28 20:01:31 +1100
commit991db50f883c14f7f1731f5d22713168320a0c76 (patch)
treeb641ae564a031e07a96d7091896b666ba5c6ac28
parentee189fd511e1a2c06f05e0d40e1d0b8875151391 (diff)
downloadgitlab-ce-991db50f883c14f7f1731f5d22713168320a0c76.tar.gz
[Rails5] Update `ApplicationController#log_exception` to fix `undefined method 'clean'` error
This commit fixes the error: ``` 1) Projects::TodosController Merge Requests POST create when not authorized for merge_request doesn't create todo Failure/Error: application_trace = ActionDispatch::ExceptionWrapper.new(env, exception).application_trace NoMethodError: undefined method `clean' for #<Hash:0x000055be5bda35d0> Did you mean? clear # ./app/controllers/application_controller.rb:113:in `log_exception' # ./app/controllers/application_controller.rb:40:in `block in <class:ApplicationController>' # ./spec/controllers/projects/todos_controller_spec.rb:80:in `go' # ./spec/controllers/projects/todos_controller_spec.rb:138:in `block (6 levels) in <top (required)>' # ./spec/controllers/projects/todos_controller_spec.rb:138:in `block (5 levels) in <top (required)>' # ------------------ # --- Caused by: --- # ActiveRecord::RecordNotFound: # Couldn't find MergeRequest # ./app/finders/concerns/finder_methods.rb:19:in `raise_not_found_unless_authorized' Finished in 7.53 seconds (files took 12.8 seconds to load) 1 example, 1 failure ``` Also see https://github.com/rails/rails/commit/6d85804bc6aeecce5669fb4b0d7b33c069deff3a
-rw-r--r--app/controllers/application_controller.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 0fdd4d2cb47..8ad13a82f89 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -110,7 +110,8 @@ class ApplicationController < ActionController::Base
def log_exception(exception)
Raven.capture_exception(exception) if sentry_enabled?
- application_trace = ActionDispatch::ExceptionWrapper.new(env, exception).application_trace
+ backtrace_cleaner = Gitlab.rails5? ? env["action_dispatch.backtrace_cleaner"] : env
+ application_trace = ActionDispatch::ExceptionWrapper.new(backtrace_cleaner, exception).application_trace
application_trace.map! { |t| " #{t}\n" }
logger.error "\n#{exception.class.name} (#{exception.message}):\n#{application_trace.join}"
end