module CardController::Errors

controller error handling

Public Instance Methods

debug_exception?(e) click to toggle source

TODO: move to exception object

# File lib/card_controller/errors.rb, line 27
def debug_exception? e
  !e.is_a?(Card::Error::UserError) &&
    !e.is_a?(ActiveRecord::RecordInvalid) &&
    Card::Codename[:debugger] &&
    Card[:debugger]&.content =~ /on/  # && !Card::Env.ajax?
end
handle_exception(exception) click to toggle source
# File lib/card_controller/errors.rb, line 18
def handle_exception exception
  raise exception if debug_exception?(exception)

  @card ||= Card.new
  error = Card::Error.report exception, card
  show error.class.view, error.class.status_code
end