From 1e672227a23afbb9f319a0aefa0b0ca3495fa1c6 Mon Sep 17 00:00:00 2001 From: Azul Date: Mon, 21 Nov 2016 16:14:38 +0100 Subject: bugfix: handle couch 404s our special error handler for json requests would turn all exceptions into 500s - removed it. now the rescue_responses can do their thing again. --- app/controllers/application_controller.rb | 10 ---------- app/controllers/errors_controller.rb | 2 -- app/views/errors/server_error.json | 4 ++-- 3 files changed, 2 insertions(+), 14 deletions(-) (limited to 'app') diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 8d08a2c..1f37fea 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -10,9 +10,6 @@ class ApplicationController < ActionController::Base # rendered and that template is not present before_filter :verify_request_format!, if: :mime_types_specified - rescue_from StandardError, :with => :default_error_handler - rescue_from CouchRest::Exception, :with => :default_error_handler - ActiveSupport.run_load_hooks(:application_controller, self) protected @@ -22,13 +19,6 @@ class ApplicationController < ActionController::Base mimes.present? end - def default_error_handler(exc) - respond_to do |format| - format.json { render_json_error(exc) } - format.all { raise exc } # reraise the exception so the normal thing happens. - end - end - # # I think this should be 'errors', not 'error', since that is what # `respond_with @object` will return. For now, I am leaving this as 'error', diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb index 80c270f..2d918b5 100644 --- a/app/controllers/errors_controller.rb +++ b/app/controllers/errors_controller.rb @@ -1,6 +1,4 @@ -# We render http errors ourselves so we can customize them class ErrorsController < ApplicationController - respond_to :html # 404 def not_found diff --git a/app/views/errors/server_error.json b/app/views/errors/server_error.json index d9a1a86..a2763f6 100644 --- a/app/views/errors/server_error.json +++ b/app/views/errors/server_error.json @@ -1,4 +1,4 @@ { - "error": "server_error", + "error": "server failed", "message": "Server Error" -} \ No newline at end of file +} -- cgit v1.2.3