Class: Cybertrain::ErrorEvent

Inherits:
Object
  • Object
show all
Defined in:
cybertrain/error_reporter.rb

Overview

One error report as a subscriber receives it: Strings (and a Boolean, a Hash of Strings, an Array of Strings and a Time), so that it is a value that crosses threads (spec section 13.3). Every reader carries the error_ prefix, so that no model column or other method of the same name has another return type (spikes/NOTES.md rules 10 and 34).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error_class, error_message, where, request_id, request_method, request_path, environment, release, handled, context, backtrace, occurred_at) ⇒ ErrorEvent

Returns a new instance of ErrorEvent.

Parameters:

  • error_class (String)
  • error_message (String)
  • where (String)
  • request_id (String)
  • request_method (String)
  • request_path (String)
  • environment (String)
  • release (String)
  • handled (Boolean)
  • context (Hash{String => String})
  • backtrace (Array<String>)
  • occurred_at (Time)


106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'cybertrain/error_reporter.rb', line 106

def initialize(error_class, error_message, where, request_id, request_method, request_path, environment, release,
               handled, context, backtrace, occurred_at)
  @error_class = error_class
  @error_message = error_message
  @error_where = where
  @error_request_id = request_id
  @error_request_method = request_method
  @error_request_path = request_path
  @error_environment = environment
  @error_release = release
  @error_handled = handled
  @error_context = context
  @error_backtrace = backtrace
  @error_occurred_at = occurred_at
end

Instance Attribute Details

#error_message=(text) ⇒ nil

Replaces the message: what an Cybertrain::ErrorReporter::Filter calls to redact it. The class name, where, the request’s fields and the backtrace have no setter.

Parameters:

  • text (String)

Returns:

  • (nil)


128
129
130
131
# File 'cybertrain/error_reporter.rb', line 128

def error_message=(text)
  @error_message = text.to_s
  nil
end

Instance Method Details

#delete_error_context(key) ⇒ nil

Removes one context entry; nothing happens when there is none. For an Cybertrain::ErrorReporter::Filter.

Parameters:

  • key (String)

Returns:

  • (nil)


149
150
151
152
# File 'cybertrain/error_reporter.rb', line 149

def delete_error_context(key)
  @error_context.delete(key.to_s)
  nil
end

#set_error_context(key, value) ⇒ nil

Sets one context entry (key and value as Strings), adding it or replacing its value: for an Cybertrain::ErrorReporter::Filter.

Parameters:

  • key (String)
  • value (String)

Returns:

  • (nil)


139
140
141
142
# File 'cybertrain/error_reporter.rb', line 139

def set_error_context(key, value)
  @error_context[key.to_s] = value.to_s
  nil
end