Class: Hoss::Transport::Serializers::ErrorSerializer Private

Inherits:
Serializer
  • Object
show all
Defined in:
lib/hoss/transport/serializers/error_serializer.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary

Attributes inherited from Serializer

#config

Instance Method Summary collapse

Methods inherited from Serializer

#initialize

Constructor Details

This class inherits a constructor from Hoss::Transport::Serializers::Serializer

Instance Method Details

#build(error) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/hoss/transport/serializers/error_serializer.rb', line 29

def build(error)
  base = {
    id: error.id,
    transaction_id: error.transaction_id,
    transaction: build_transaction(error.transaction),
    trace_id: error.trace_id,
    parent_id: error.parent_id,

    culprit: keyword_field(error.culprit),
    timestamp: error.timestamp
  }

  if (context = context_serializer.build(error.context))
    base[:context] = context
  end

  if (exception = error.exception)
    base[:exception] = build_exception exception
  end

  if (log = error.log)
    base[:log] = build_log log
  end

  { error: base }
end

#context_serializerObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
# File 'lib/hoss/transport/serializers/error_serializer.rb', line 25

def context_serializer
  @context_serializer ||= ContextSerializer.new(config)
end