From 900e0fbcc4626bdf57e455836f86367e3ec36d69 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 31 Aug 2019 21:03:16 +0200 Subject: 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(+) (limited to 'guix') 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)))))) -- cgit v1.2.3