Skip to content

Commit 75b5ac9

Browse files
committed
check if top level Rails constant is defined
1 parent 698641e commit 75b5ac9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sentry-sidekiq/lib/sentry/sidekiq/error_handler.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def call(ex, context, sidekiq_config = nil)
5555
private
5656

5757
def report_error(ex, context, hint: {})
58-
if Sentry.configuration.sidekiq.report_errors_via_rails
58+
if Sentry.configuration.sidekiq.report_errors_via_rails && defined?(::Rails)
5959
mechanism = Sentry::Mechanism.new(type: "sidekiq", handled: false)
6060
::Rails.error.report(ex, context: { sidekiq: context, hint: hint.merge(mechanism: mechanism) }, handled: false)
6161
else

0 commit comments

Comments
 (0)