Sha256: 1b89134b5d8646b974b431a486bde70dc73e6d654f75827a4d43e6dc1533b7fe

Contents?: true

Size: 631 Bytes

Versions: 7

Compression:

Stored size: 631 Bytes

Contents

class Card
  class Format
    module Error
      def rescue_view e, view
        raise e if Rails.env =~ /^cucumber|test$/
        error_view = Card::Error.exception_view @card, e
        # TODO: consider rendering dynamic error view here.
        rendering_error e, view
      end

      def debug_error e
        debug = Card[:debugger]
        raise e if debug && debug.content == "on"
      end

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
card-1.91 lib/card/format/error.rb
card-1.21.0 lib/card/format/error.rb
card-1.20.4 lib/card/format/error.rb
card-1.20.3 lib/card/format/error.rb
card-1.20.2 lib/card/format/error.rb
card-1.20.1 lib/card/format/error.rb
card-1.20.0 lib/card/format/error.rb