Module: Card::Format::Error

Included in:
Card::Format
Defined in:
lib/card/format/error.rb

Instance Method Summary collapse

Instance Method Details

#debug_error(e, view) ⇒ Object



11
12
13
14
15
16
# File 'lib/card/format/error.rb', line 11

def debug_error e, view
  Rails.logger.info "\nError rendering #{error_cardname} / #{view}: "\
                    "#{e.class} : #{e.message}"
  debug = Card[:debugger]
  raise e if debug && debug.content == "on"
end

#error_cardnameObject



18
19
20
# File 'lib/card/format/error.rb', line 18

def error_cardname
  card && card.name.present? ? card.name : "unknown card"
end

#rendering_error(_exception, view) ⇒ Object



22
23
24
# File 'lib/card/format/error.rb', line 22

def rendering_error _exception, view
  "Error rendering: #{error_cardname} (#{view} view)"
end

#rescue_view(e, view) ⇒ Object



4
5
6
7
8
9
# File 'lib/card/format/error.rb', line 4

def rescue_view e, view
  raise e if Rails.env =~ /^cucumber|test$/
  Card::Error.current = e
  card.notable_exception_raised
  rendering_error e, view
end