summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2013-11-12 14:50:14 +0100
committerAzul <azul@leap.se>2013-11-12 14:50:14 +0100
commit11e80906b49bea120ae398c7d6524127eaa9363a (patch)
treef4280d6ace7b0cdb54ae343514a1d716bdb3492d /app/controllers
parenta976436d6c022b5a1d142a931ba0bf6d27a00e9c (diff)
make sure we log json request errors and their backtraces
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/application_controller.rb6
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