lib/materialist/workers/event.rb in materialist-3.2.0 vs lib/materialist/workers/event.rb in materialist-3.3.0

- old
+ new

@@ -14,12 +14,13 @@ materializer = Materialist::MaterializerFactory.class_from_topic(topic) materializer.perform(event['url'], action) report_latency(topic, timestamp) if timestamp report_stats(topic, action, :success) - rescue + rescue Exception => exception report_stats(topic, action, :failure) + notice_error(exception, event) raise end private @@ -35,9 +36,14 @@ def report_stats(topic, action, kind) Materialist.configuration.metrics_client.increment( "materialist.event_worker.#{kind}", tags: ["action:#{action}", "topic:#{topic}"] ) + end + + def notice_error(exception, event) + return unless handler = Materialist.configuration.notice_error + handler.call(exception, event) end end end end