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.
master
Ludovic Courtès 2019-08-31 21:03:16 +02:00
parent 2c0040ae30
commit 900e0fbcc4
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 10 additions and 0 deletions

View File

@ -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))))))