module OpenStax::RescueFrom::Controller

Public Class Methods

included(base) click to toggle source
# File lib/openstax/rescue_from/controller.rb, line 4
def self.included(base)
  base.extend ClassMethods
end

Public Instance Methods

openstax_exception_rescued(proxy, did_notify) click to toggle source
# File lib/openstax/rescue_from/controller.rb, line 16
def openstax_exception_rescued(proxy, did_notify)
  @message = proxy.friendly_message
  @code = proxy.status_code
  @error_id = proxy.error_id
  @sorry = proxy.sorry
  @did_notify = did_notify

  respond_to do |f|
    f.html { render template: openstax_rescue_config.html_error_template_path,
                    layout: openstax_rescue_config.html_error_template_layout_name,
                    status: proxy.status }

    f.json { render json: { error_id: did_notify ? proxy.error_id : nil },
                    status: proxy.status }

    f.all { head proxy.status }
  end
end

Private Instance Methods

openstax_rescue_config() click to toggle source
# File lib/openstax/rescue_from/controller.rb, line 36
def openstax_rescue_config
  RescueFrom.configuration
end