From 370a4ad2ca0e3bf9317a117eeb78846a5a39975d Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <othacehe@gnu.org>
Date: Wed, 24 Feb 2021 12:10:32 +0100
Subject: [PATCH] notification: Catch notifications errors.

* src/cuirass/notification.scm (notification-email, notification-mastodon):
Catch notification errors.
---
 src/cuirass/notification.scm | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/cuirass/notification.scm b/src/cuirass/notification.scm
index ddadac09..3de7f5bd 100644
--- a/src/cuirass/notification.scm
+++ b/src/cuirass/notification.scm
@@ -105,16 +105,26 @@ the detailed information about this build here: ~a."
          (server (assq-ref notification #:server))
          (subject (notification-subject notification))
          (text (notification-text notification)))
-    (send-email server
-                #:from from
-                #:to to
-                #:subject subject
-                #:text text)))
+    (catch #t
+      (lambda ()
+        (send-email server
+                    #:from from
+                    #:to to
+                    #:subject subject
+                    #:text text))
+      (lambda args
+        (log-message "Failed to send the email notification: ~a."
+                     args)))))
 
 (define (notification-mastodon notification)
   "Send a new status for the given NOTIFICATION."
   (let ((text (notification-text notification)))
-    (send-status text)))
+    (catch #t
+      (lambda ()
+        (send-status text))
+      (lambda args
+        (log-message "Failed to send the mastodon notification: ~a."
+                     args)))))
 
 (define* (send-notifications notifications #:key build)
   "Send the notifications in NOTIFICATIONS list, regarding the given BUILD."
-- 
GitLab