[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/03: lint: Gracefully handle errors from 'connect' & co.
From: |
guix-commits |
Subject: |
03/03: lint: Gracefully handle errors from 'connect' & co. |
Date: |
Sat, 31 Aug 2019 15:10:47 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 900e0fbcc4626bdf57e455836f86367e3ec36d69
Author: Ludovic Courtès <address@hidden>
Date: Sat Aug 31 21:03:16 2019 +0200
lint: Gracefully handle errors from 'connect' & co.
* guix/lint.scm (call-with-networking-fail-safe): Add case for
'system-error' as typically raised by 'connect' & co.
---
guix/lint.scm | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/guix/lint.scm b/guix/lint.scm
index 2bf50974..254f4e2 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -950,6 +950,16 @@ display a message including MESSAGE and return
ERROR-VALUE."
message
(tls-certificate-error-string args))
error-value)
+ ((and ('system-error _ ...) args)
+ (let ((errno (system-error-errno args)))
+ (if (member errno (list ECONNRESET ECONNABORTED ECONNREFUSED))
+ (let ((details (call-with-output-string
+ (lambda (port)
+ (print-exception port #f (car args)
+ (cdr args))))))
+ (warning (G_ "~a: ~a~%") message details)
+ error-value)
+ (apply throw args))))
(args
(apply throw args))))))