aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-08-31 12:06:36 +0100
committerChristopher Baines <mail@cbaines.net>2019-08-31 12:06:36 +0100
commitd35cc85d52c2200dc3859bd0f426a3c01e4d906d (patch)
tree1d84dc5737c2aba1b643d496487708c17741a3d4
parent84ad3656df1374e0b9f4eb4b704b04cdf8f8bf87 (diff)
downloaddata-service-d35cc85d52c2200dc3859bd0f426a3c01e4d906d.tar
data-service-d35cc85d52c2200dc3859bd0f426a3c01e4d906d.tar.gz
Improve error handling for processing emails
-rw-r--r--scripts/guix-data-service-process-branch-updated-email.in24
1 files changed, 20 insertions, 4 deletions
diff --git a/scripts/guix-data-service-process-branch-updated-email.in b/scripts/guix-data-service-process-branch-updated-email.in
index 6170a32..429684a 100644
--- a/scripts/guix-data-service-process-branch-updated-email.in
+++ b/scripts/guix-data-service-process-branch-updated-email.in
@@ -31,7 +31,23 @@
(with-postgresql-connection
"process-branch-updated-email"
(lambda (conn)
- (enqueue-job-for-email
- conn
- (parse-email
- (get-string-all (current-input-port))))))
+ (let* ((email-string
+ (get-string-all (current-input-port)))
+ (email
+ (catch
+ #t
+ (lambda ()
+ (parse-email email-string))
+ (lambda (key . args)
+ (display "\nerror: while processing email\n"
+ (current-error-port))
+ (simple-format (current-error-port)
+ "~A: ~A\n\n"
+ key
+ args)
+ (display email-string (current-error-port))
+ (display "\n\n" (current-error-port))
+ #f))))
+ (when email
+ (enqueue-job-for-email conn email)))))
+