Sha256: f27031821f9e2b1165c4a2d504eae410dc28caaaf51ba8391408dffe39129007

Contents?: true

Size: 674 Bytes

Versions: 2

Compression:

Stored size: 674 Bytes

Contents

# When an exception happens inside a view, it is wrapped with an
# ActionView::TemplateError. The lookup for the rescue_with_handler
# then fails to find the handle for the original exception. This solution
# special cases the template error to look also at the wrapped exception
# and if there is a handler for that exception, then call it and ignore
# the wrapping.
module RescueWithHelper
  def rescue_with_handler(exception)
    if ((exception.class == ActionView::TemplateError) &&
      (orig_exception = exception.original_exception) &&
      (orig_handler = handler_for_rescue(orig_exception)))
      exception = orig_exception
    end
    super(exception)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
objectreload-pagination-0.1.9 lib/action_controller/rescue_with_helper.rb
objectreload-pagination-0.1.8 lib/action_controller/rescue_with_helper.rb