dawarich/app/services/exception_reporter.rb
2025-12-07 12:53:10 +01:00

15 lines
455 B
Ruby

# frozen_string_literal: true
class ExceptionReporter
def self.call(exception, human_message = 'Exception reported')
return if DawarichSettings.self_hosted?
if exception.is_a?(Exception)
Rails.logger.error "#{human_message}: #{exception.message}"
Sentry.capture_exception(exception)
else
Rails.logger.error "#{exception}: #{human_message}"
Sentry.capture_message("#{exception}: #{human_message}")
end
end
end