Class: SentryException
- Inherits:
-
Object
- Object
- SentryException
- Defined in:
- lib/fluent/plugin/out_sentry.rb
Instance Attribute Summary collapse
-
#values ⇒ Object
Returns the value of attribute values.
Instance Method Summary collapse
- #add_error_type_and_message(type, message) ⇒ Object
- #add_values(frame) ⇒ Object
-
#initialize(exception) ⇒ SentryException
constructor
A new instance of SentryException.
- #to_json(*_args) ⇒ Object
Constructor Details
#initialize(exception) ⇒ SentryException
Returns a new instance of SentryException.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fluent/plugin/out_sentry.rb', line 9 def initialize(exception) self.values = [] trace = {} trace['stacktrace'] = {} trace['stacktrace']['frames'] = [] values.push(trace) frames = exception['frames'] p exception p frames frames.each do |frame| add_values(frame) end (exception['error_type'], exception['error_message']) values[0]['mechanism'] = {} values[0]['mechanism']['type'] = 'generic' values[0]['mechanism']['handled'] = true end |
Instance Attribute Details
#values ⇒ Object
Returns the value of attribute values.
7 8 9 |
# File 'lib/fluent/plugin/out_sentry.rb', line 7 def values @values end |
Instance Method Details
#add_error_type_and_message(type, message) ⇒ Object
42 43 44 45 |
# File 'lib/fluent/plugin/out_sentry.rb', line 42 def (type, ) values[0]['type'] = type values[0]['value'] = end |
#add_values(frame) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/fluent/plugin/out_sentry.rb', line 30 def add_values(frame) sentry_frame = { in_app: frame['in_app'] || false, function: frame['function_name'] || nil, filename: frame['file_name'] || nil, lineno: frame['line_number'] || nil, colno: frame['column_number'] || nil } values[0]['stacktrace']['frames'].push(sentry_frame) end |
#to_json(*_args) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/fluent/plugin/out_sentry.rb', line 47 def to_json(*_args) hash = {} instance_variables.each do |var| hash[var.to_s.delete '@'] = instance_variable_get var end hash.to_json end |