Skip to content

Commit

Permalink
current_component will always be defined
Browse files Browse the repository at this point in the history
  • Loading branch information
p committed Dec 17, 2024
1 parent 88f52fc commit 7dc8212
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/datadog/di/code_tracker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ def start
# customer applications.
rescue => exc
# Code tracker may be loaded without the rest of DI,
# in which case DI.current_component won't be defined.
if component = DI.respond_to?(:current_component) && DI.current_component
# in which case DI.component will not yet be defined,
# but we will have DI.current_component (set to nil).
if component = DI.current_component
raise if component.settings.dynamic_instrumentation.internal.propagate_all_exceptions
component.logger.warn("Unhandled exception in script_compiled trace point: #{exc.class}: #{exc}")
component.telemetry&.report(exc, description: "Unhandled exception in script_compiled trace point")
Expand Down

0 comments on commit 7dc8212

Please sign in to comment.