lib/sentry/rails/error_subscriber.rb in sentry-rails-5.21.0 vs lib/sentry/rails/error_subscriber.rb in sentry-rails-5.22.0
- old
+ new
@@ -25,10 +25,23 @@
if context[:hint].is_a?(Hash)
context = context.dup
hint.merge!(context.delete(:hint))
end
- Sentry::Rails.capture_exception(error, level: severity, contexts: { "rails.error" => context }, tags: tags, hint: hint)
+ options = { level: severity, contexts: { "rails.error" => context }, tags: tags, hint: hint }
+
+ case error
+ when String
+ Sentry::Rails.capture_message(error, **options)
+ when Exception
+ Sentry::Rails.capture_exception(error, **options)
+ else
+ log_debug("Expected an Exception or a String, got: #{error.inspect}")
+ end
+ end
+
+ def log_debug(message)
+ Sentry.configuration.logger.debug(message)
end
end
end
end