Class: Cybertrain::ErrorEvent
- Inherits:
-
Object
- Object
- Cybertrain::ErrorEvent
- 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
-
#error_message ⇒ nil
writeonly
Replaces the message: what an Cybertrain::ErrorReporter::Filter calls to redact it.
Instance Method Summary collapse
-
#delete_error_context(key) ⇒ nil
Removes one context entry; nothing happens when there is none.
-
#initialize(error_class, error_message, where, request_id, request_method, request_path, environment, release, handled, context, backtrace, occurred_at) ⇒ ErrorEvent
constructor
A new instance of ErrorEvent.
-
#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.
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.
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, , where, request_id, request_method, request_path, environment, release, handled, context, backtrace, occurred_at) @error_class = error_class @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.
128 129 130 131 |
# File 'cybertrain/error_reporter.rb', line 128 def (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.
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.
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 |