Sha256: 7336b3076df8570db571a41f87fcca48db2dbf17c841ed48495e7c4719b851bd

Contents?: true

Size: 782 Bytes

Versions: 18

Compression:

Stored size: 782 Bytes

Contents

require "logtail/util"
require "logtail/event"

module Logtail
  module Events
    # @private
    class Error < Logtail::Event
      attr_reader :name, :error_message, :backtrace_json

      def initialize(attributes)
        @name = attributes[:name]
        @error_message = attributes[:error_message]

        if attributes[:backtrace]
          @backtrace_json = attributes[:backtrace].to_json
        end
      end

      def message
        message = "#{name}"

        if !error_message.nil?
          message << " (#{error_message})"
        end

        message
      end

      def to_hash
        {
          error: {
            name: name,
            message: error_message,
            backtrace_json: backtrace_json
          }
        }
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
logtail-ruby-0.1.3 lib/logtail/events/error.rb
logtail-0.1.13 lib/logtail/events/error.rb
logtail-0.1.12 lib/logtail/events/error.rb
logtail-0.1.11 lib/logtail/events/error.rb
logtail-0.1.10 lib/logtail/events/error.rb
logtail-0.1.9 lib/logtail/events/error.rb
logtail-0.1.8 lib/logtail/events/error.rb
logtail-0.1.7 lib/logtail/events/error.rb
logtail-0.1.6 lib/logtail/events/error.rb
logtail-0.1.5 lib/logtail/events/error.rb
logtail-0.1.4 lib/logtail/events/error.rb
logtail-0.1.3 lib/logtail/events/error.rb
logtail-0.1.2 lib/logtail/events/error.rb
logtail-0.1.1 lib/logtail/events/error.rb
logtail-0.1.0 lib/logtail/events/error.rb
logtail-ruby-0.1.2 lib/logtail/events/error.rb
logtail-ruby-0.1.1 lib/logtail/events/error.rb
logtail-ruby-0.1.0 lib/logtail/events/error.rb