From 8a9950bba9a084320997081d36b11b69f0c70b5d Mon Sep 17 00:00:00 2001 From: Jon Moses Date: Sun, 8 May 2011 13:14:40 -0400 Subject: [PATCH] Rescue from logging errors after filter run --- lib/controller_filter_logging.rb | 6 +++++- lib/controller_filter_logging/version.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/controller_filter_logging.rb b/lib/controller_filter_logging.rb index 3234e80..3002984 100644 --- a/lib/controller_filter_logging.rb +++ b/lib/controller_filter_logging.rb @@ -20,7 +20,11 @@ module AbstractController::Callbacks::ClassMethods define_method("#{filter_name}_with_logging") do Rails.logger.debug("Entering before_filter: #{filter_name}") send(filter_name).tap do |result| - Rails.logger.debug(" result: #{result.inspect}") + begin + Rails.logger.debug(" result: #{result.inspect}") + rescue + Rails.logger.debug(" error outputting result: #{$!.class.name}/#{$!.message}") + end end end end diff --git a/lib/controller_filter_logging/version.rb b/lib/controller_filter_logging/version.rb index 5cce997..ce4a541 100644 --- a/lib/controller_filter_logging/version.rb +++ b/lib/controller_filter_logging/version.rb @@ -1,3 +1,3 @@ module ControllerFilterLogging - VERSION = "0.0.2" + VERSION = "0.0.3" end