diff options
author | jessib <jessib@riseup.net> | 2013-11-12 09:19:30 -0800 |
---|---|---|
committer | jessib <jessib@riseup.net> | 2013-11-12 09:19:30 -0800 |
commit | b131fd4f4d7fd23e787b18c207224216860081bb (patch) | |
tree | 64bd9acc7a756d38ac2245d9a92f67e88cce1ead /app/controllers | |
parent | 8295db1a8cf334ff8666e5ec29455c199c7ffc73 (diff) | |
parent | 11e80906b49bea120ae398c7d6524127eaa9363a (diff) |
Merge pull request #112 from azul/debug/log_json_errors
make sure we log json request errors and their backtraces
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/application_controller.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b808e1c..de8d06b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -10,12 +10,14 @@ class ApplicationController < ActionController::Base rescue_from StandardError do |e| respond_to do |format| - format.json { render_json_error } + format.json { render_json_error(e) } format.all { raise e } # reraise the exception so the normal thing happens. end end - def render_json_error + def render_json_error(e) + Rails.logger.error e + Rails.logger.error e.backtrace.join("\n") render status: 500, json: {error: "The server failed to process your request. We'll look into it."} end |