Skip to content

Commit d60b341

Browse files
authored
Added backtrace to custom exception (#4)
1 parent fdd5aa5 commit d60b341

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/datadog_notifier.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
require 'ddtrace'
44
require 'datadog_notifier_exception'
55

6+
# DatadogNotifier for custom error notification to datadog
67
class DatadogNotifier
78
def self.notify(exception, payload = {})
89
root_span = find_root_span(Datadog::Tracing.active_span)
9-
exception = DatadogNotifierException.new exception if exception.is_a?(String)
10+
if exception.is_a?(String)
11+
exception = DatadogNotifierException.new exception
12+
exception.set_backtrace(payload.inspect)
13+
end
1014
root_span.set_error(exception)
1115
root_span.set_tag('custom_dd_notifier', true)
1216
root_span.set_tag('payload', payload.to_json) if payload.present?

0 commit comments

Comments
 (0)