Method: Atatus::Transport::Serializers::ErrorSerializer#build

Defined in:
lib/atatus/transport/serializers/error_serializer.rb

#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/atatus/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