From 42ab8ee77037ce0cc1ac82d615dbf6dfb851090f Mon Sep 17 00:00:00 2001 From: Patrick Gansterer Date: Thu, 5 Oct 2017 17:40:00 +0200 Subject: [PATCH] Call the ExceptionNotifier for erros in FoodsoftMailReceiver --- lib/foodsoft_mail_receiver.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/foodsoft_mail_receiver.rb b/lib/foodsoft_mail_receiver.rb index b84582c9b..e5250f7f8 100644 --- a/lib/foodsoft_mail_receiver.rb +++ b/lib/foodsoft_mail_receiver.rb @@ -29,10 +29,16 @@ def on_rcpt_to_event(ctx, rcpt_to) end def on_message_data_event(ctx) - @handlers.each do |handler| - handler.call(ctx[:message][:data]) + begin + @handlers.each do |handler| + handler.call(ctx[:message][:data]) + end + rescue => error + ExceptionNotifier.notify_exception(error, data: ctx) + raise error + ensure + @handlers.clear end - @handlers.clear end def self.find_handler(recipient)