Sha256: b5c696b8693c251481099637ffd0c6e8649292b4270e80b29843b9e16360ef49

Contents?: true

Size: 863 Bytes

Versions: 7

Compression:

Stored size: 863 Bytes

Contents

module Percheron
  class OhDear

    def initialize(exception)
      @exception = exception
    end

    def generate
      template
    end

    private

      attr_reader :exception

      # rubocop:disable Metrics/MethodLength
      def template
        <<-EOS

OH DEAR, we are terribly sorry.. something unexpected occurred :(

--snip--

Info
----
Ruby: #{RUBY_VERSION}
Percheron: #{Percheron::VERSION}

Trace
-----
#{exception_message}

#{exception_backtrace}

--snip--

Please copy the detail between the --snip--'s above and raise a ticket please :)

https://github.com/ashmckenzie/percheron/issues/new?labels=bug

EOS
      end
      # rubocop:enable Metrics/MethodLength

      def exception_message
        exception.inspect
      end

      def exception_backtrace
        exception.backtrace ? exception.backtrace.join("\n") : ''
      end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
percheron-0.7.6 lib/percheron/oh_dear.rb
percheron-0.7.5 lib/percheron/oh_dear.rb
percheron-0.7.4 lib/percheron/oh_dear.rb
percheron-0.7.3 lib/percheron/oh_dear.rb
percheron-0.7.2 lib/percheron/oh_dear.rb
percheron-0.7.1 lib/percheron/oh_dear.rb
percheron-0.7.0 lib/percheron/oh_dear.rb