Class: SpreeSquare::Alerting
- Inherits:
-
Object
- Object
- SpreeSquare::Alerting
- Defined in:
- app/services/spree_square/alerting.rb
Overview
One place for "this needs a human" — used when a job exhausts its retries. Reports to Sentry (already in this app's stack) when available, always logs at error level regardless so nothing depends on Sentry being configured to at least be visible in the server log.
Class Method Summary collapse
Class Method Details
.capture(error, context: {}) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'app/services/spree_square/alerting.rb', line 7 def self.capture(error, context: {}) context = { source: 'spree_square' }.merge(context.is_a?(String) ? { area: context } : context) Rails.logger.error("[SpreeSquare] #{context[:area] || 'error'}: #{error.class}: #{error.}") return unless defined?(Sentry) Sentry.capture_exception(error, extra: context) end |