app/controllers/kadmin/application_controller.rb in kadmin-0.2.6 vs app/controllers/kadmin/application_controller.rb in kadmin-0.2.7

- old
+ new

@@ -14,20 +14,25 @@ before_action :set_default_format # @!group Error Handling unless defined?(BetterErrors) - rescue_from StandardError, with: :handle_error + rescue_from StandardError, with: :handle_unexpected_error rescue_from ActiveRecord::RecordNotFound, with: :not_found rescue_from ActionController::ParameterMissing, with: :params_missing end def params_missing(error) handle_error(error, title: I18n.t('kadmin.errors.params_missing'), status: :bad_request) end def not_found(error) handle_error(error, title: I18n.t('kadmin.errors.not_found'), status: :not_found) + end + + def handle_unexpected_error(error) + Rails.logger.error(error) + handle_error(error, title: I18n.t('kadmin.errors.unexpected'), message: I18n.t('kadmin.errors.unexpected_message')) end def handle_error(error, options = {}) options = { title: error.try(:title) || error.class.name,