diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm index 1b2d735d68..9726a80753 100755 --- a/guix/scripts/substitute.scm +++ b/guix/scripts/substitute.scm @@ -615,13 +615,7 @@ (define network-error? (and (kind-and-args? exception) (memq (exception-kind exception) '(gnutls-error getaddrinfo-error))) - (and (http-get-error? exception) - (begin - (warning (G_ "download from '~a' failed: ~a, ~s~%") - (uri->string (http-get-error-uri exception)) - (http-get-error-code exception) - (http-get-error-reason exception)) - #t)))))) + (http-get-error? exception))))) (define* (process-substitution/fallback port narinfo destination #:key cache-urls acl @@ -649,7 +643,13 @@ (define* (process-substitution/fallback port narinfo destination (if (or (equivalent-narinfo? narinfo alternate) (valid-narinfo? alternate acl) (%allow-unauthenticated-substitutes?)) - (guard (c ((network-error? c) (loop rest))) + (guard (c ((network-error? c) + (when (http-get-error? c) + (warning (G_ "download from '~a' failed: ~a, ~s~%") + (uri->string (http-get-error-uri c)) + (http-get-error-code c) + (http-get-error-reason c))) + (loop rest))) (download-nar alternate destination #:status-port port #:deduplicate? deduplicate? @@ -677,6 +677,11 @@ (define narinfo store-item)) (guard (c ((network-error? c) + (when (http-get-error? c) + (warning (G_ "download from '~a' failed: ~a, ~s~%") + (uri->string (http-get-error-uri c)) + (http-get-error-code c) + (http-get-error-reason c))) (format (current-error-port) (G_ "retrying download of '~a' with other substitute URLs...~%") store-item)