Sha256: e510210fd735d71f2e836113df6bf4e1722caa73ad11e034fa0ef2bf8b8acb24

Contents?: true

Size: 508 Bytes

Versions: 2

Compression:

Stored size: 508 Bytes

Contents

module StaticMatic
  module Rescue
    # Render an error template for the given exception
    def rescue_from_error(exception)
      rescue_template = (exception == ActionView::TemplateError) ?
        "template_error" :
        "default_error"
      
      error_template_path = File.expand_path(File.dirname(__FILE__) + "/templates/rescues/#{rescue_template}.html.erb")
      @template.instance_variable_set("@exception", exception)
      @template.render_file(error_template_path, false)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tdreyno-staticmatic-2.0.3 lib/staticmatic/rescue.rb
tdreyno-staticmatic-2.1.0 lib/staticmatic/rescue.rb