summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-08-31 21:03:16 +0200
committerLudovic Courtès <ludo@gnu.org>2019-08-31 21:04:09 +0200
commit900e0fbcc4626bdf57e455836f86367e3ec36d69 (patch)
tree653600191db41fc4fea30693058517f0e2e7df3b
parent2c0040ae302fa8549161754283b404b9dd22a619 (diff)
downloadguix-900e0fbcc4626bdf57e455836f86367e3ec36d69.tar.gz
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.
-rw-r--r--guix/lint.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/guix/lint.scm b/guix/lint.scm
index 2bf5097403..254f4e2830 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))))))