From ba1795ce511891d211d8ef3024b123e9cbd5eca7 Mon Sep 17 00:00:00 2001 From: Leon Matthes Date: Fri, 26 Apr 2019 14:47:31 +0200 Subject: [PATCH] Comment(User): no way to log a failing save for notifications --- app/models/user.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index 2177e41f..532a4877 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -61,7 +61,10 @@ def notify(title, message, link = '', type: :default) else notify_slack("*#{title}*\n#{message}\n#{link}") NotificationMailer.with(user: self, title: '[HART] ' + title.to_s, message: (message + link).to_s).notify_email.deliver_now if email_notifications - notification.save # saving might fail, but there is no useful way to handle the error. + notification.save + # saving might fail, there is however no good way to handle this error. + # We cannot log the error, because when using the HartFormatter, logging errors creates new notifications, + # these might also fail to save, creating an endless recursion. end end