scripts: substitute: Replace some leave calls with raise.
These calls happen inside of with-error-handling, so the effect should be the same, but this opens up the possibility of using this code in a program that doesn't want to exit when one of these error conditions is met. Change-Id: I15d963615d85d419559fa0f4333fa4dc1dfbfd3b * guix/scripts/substitute.scm (download-nar, process-substitution): Use raise formatted-message rather than leave. Change-Id: Idd0880206b69e3903e19e0536b87d65a52c200d5
This commit is contained in:
parent
dcf0cca8d7
commit
ecbab97f07
@ -495,8 +495,10 @@ STATUS-PORT."
|
|||||||
#:keep-alive? #t
|
#:keep-alive? #t
|
||||||
#:buffered? #f))))
|
#:buffered? #f))))
|
||||||
(else
|
(else
|
||||||
(leave (G_ "unsupported substitute URI scheme: ~a~%")
|
(raise
|
||||||
(uri->string uri)))))
|
(formatted-message
|
||||||
|
(G_ "unsupported substitute URI scheme: ~a~%")
|
||||||
|
(uri->string uri))))))
|
||||||
|
|
||||||
(define (try-fetch choices)
|
(define (try-fetch choices)
|
||||||
(match choices
|
(match choices
|
||||||
@ -513,9 +515,11 @@ STATUS-PORT."
|
|||||||
(G_ "Downloading ~a...~%") (uri->string uri)))
|
(G_ "Downloading ~a...~%") (uri->string uri)))
|
||||||
(values port uri compression download-size))))
|
(values port uri compression download-size))))
|
||||||
(()
|
(()
|
||||||
(leave (G_ "no valid nar URLs for ~a at ~a~%")
|
(raise
|
||||||
(narinfo-path narinfo)
|
(formatted-message
|
||||||
(narinfo-uri-base narinfo)))))
|
(G_ "no valid nar URLs for ~a at ~a~%")
|
||||||
|
(narinfo-path narinfo)
|
||||||
|
(narinfo-uri-base narinfo))))))
|
||||||
|
|
||||||
;; Delete DESTINATION first--necessary when starting over after a failed
|
;; Delete DESTINATION first--necessary when starting over after a failed
|
||||||
;; download.
|
;; download.
|
||||||
@ -680,8 +684,10 @@ PORT."
|
|||||||
(cut valid-narinfo? <> acl))))
|
(cut valid-narinfo? <> acl))))
|
||||||
|
|
||||||
(unless narinfo
|
(unless narinfo
|
||||||
(leave (G_ "no valid substitute for '~a'~%")
|
(raise
|
||||||
store-item))
|
(formatted-message
|
||||||
|
(G_ "no valid substitute for '~a'~%")
|
||||||
|
store-item)))
|
||||||
|
|
||||||
(guard (c ((network-error? c)
|
(guard (c ((network-error? c)
|
||||||
(when (http-get-error? c)
|
(when (http-get-error? c)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user