Sha256: 9ee197129c2c7723c338604bb351c53b6e689052d9e1c872207f63737fcdd646

Contents?: true

Size: 457 Bytes

Versions: 10

Compression:

Stored size: 457 Bytes

Contents

# frozen_string_literal: true

module Twiglet
  class ErrorSerialiser
    def serialise_error(error)
      error_fields = {
        error: {
          type: error.class.to_s,
          message: error.message
        }
      }
      add_stack_trace(error_fields, error)
    end

    private

    def add_stack_trace(hash_to_add_to, error)
      hash_to_add_to[:error][:stack_trace] = error.backtrace if error.backtrace
      hash_to_add_to
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
twiglet-3.13.5 lib/twiglet/error_serialiser.rb
twiglet-3.13.4 lib/twiglet/error_serialiser.rb
twiglet-3.13.0 lib/twiglet/error_serialiser.rb
twiglet-3.12.0 lib/twiglet/error_serialiser.rb
twiglet-3.11.0 lib/twiglet/error_serialiser.rb
twiglet-3.10.0 lib/twiglet/error_serialiser.rb
twiglet-3.9.2 lib/twiglet/error_serialiser.rb
twiglet-3.9.1 lib/twiglet/error_serialiser.rb
twiglet-3.9.0 lib/twiglet/error_serialiser.rb
twiglet-3.8.0 lib/twiglet/error_serialiser.rb