Sha256: 4add71dc37f979fb59960d538fb7c17193c2fd33ebf73029e7685c5db38166fa

Contents?: true

Size: 665 Bytes

Versions: 7

Compression:

Stored size: 665 Bytes

Contents

# coding: utf-8

module Resque
  module Integration
    # Extend your job with this class to see full backtrace in resque log
    module Backtrace
      def around_perform_backtrace(*)
        yield
      rescue => ex
        $stderr.puts(_format_exception(ex))

        raise
      end

      private
      def _format_exception(exception)
        bt = exception.backtrace.dup

        "%s %s: %s (%s)\n%s" % [
          Time.now.to_s,
          bt.shift,
          exception.message,
          exception.class.to_s,
          bt.map { |line| ' ' * 4 + line }.join("\n")
        ]
      end
    end # module Backtrace
  end # module Integration
end # module Resque

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
resque-integration-3.8.2 lib/resque/integration/backtrace.rb
resque-integration-3.8.1 lib/resque/integration/backtrace.rb
resque-integration-3.8.0 lib/resque/integration/backtrace.rb
resque-integration-3.7.1 lib/resque/integration/backtrace.rb
resque-integration-3.5.1 lib/resque/integration/backtrace.rb
resque-integration-3.5.0 lib/resque/integration/backtrace.rb
resque-integration-3.4.1 lib/resque/integration/backtrace.rb