From: Christopher Baines <mail@cbaines.net>
To: 69291@debbugs.gnu.org
Cc: "Christopher Baines" <guix@cbaines.net>,
"Josselin Poiret" <dev@jpoiret.xyz>,
"Ludovic Courtès" <ludo@gnu.org>,
"Mathieu Othacehe" <othacehe@gnu.org>,
"Ricardo Wurmus" <rekado@elephly.net>,
"Simon Tournier" <zimon.toutoune@gmail.com>,
"Tobias Geerinckx-Rice" <me@tobias.gr>
Subject: [bug#69291] [PATCH 3/5] scripts: substitute: Replace some leave calls with raise.
Date: Tue, 20 Feb 2024 19:42:25 +0000 [thread overview]
Message-ID: <3a88dc8a8369278f86f3a51a99aa62d991ba997d.1708458147.git.mail@cbaines.net> (raw)
In-Reply-To: <c689a478b1b123eb607a89b2ec295b491d79f39f.1708458147.git.mail@cbaines.net>
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
---
guix/scripts/substitute.scm | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index 575fa2a0b3..1875a4332d 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -495,8 +495,10 @@ (define* (download-nar narinfo destination
#:keep-alive? #t
#:buffered? #f))))
(else
- (leave (G_ "unsupported substitute URI scheme: ~a~%")
- (uri->string uri)))))
+ (raise
+ (formatted-message
+ (G_ "unsupported substitute URI scheme: ~a~%")
+ (uri->string uri))))))
(define (try-fetch choices)
(match choices
@@ -511,9 +513,11 @@ (define* (download-nar narinfo destination
(G_ "Downloading ~a...~%") (uri->string uri)))
(values port uri compression download-size))))
(()
- (leave (G_ "no valid nar URLs for ~a at ~a~%")
- (narinfo-path narinfo)
- (narinfo-uri-base narinfo)))))
+ (raise
+ (formatted-message
+ (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
;; download.
@@ -678,8 +682,10 @@ (define* (process-substitution port store-item destination
(cut valid-narinfo? <> acl))))
(unless narinfo
- (leave (G_ "no valid substitute for '~a'~%")
- store-item))
+ (raise
+ (formatted-message
+ (G_ "no valid substitute for '~a'~%")
+ store-item)))
(guard (c ((network-error? c)
(when (http-get-error? c)
--
2.41.0
next prev parent reply other threads:[~2024-02-20 19:42 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-20 19:05 [bug#69291] [PATCH 0/5] Start making substitute code less coupled Christopher Baines
2024-02-20 19:42 ` [bug#69291] [PATCH 1/5] scripts: substitute: Remove side effect warning from network-error? Christopher Baines
2024-02-20 19:42 ` [bug#69291] [PATCH 2/5] scripts: substitute: Allow not using with-timeout in download-nar Christopher Baines
2024-02-23 16:19 ` Ludovic Courtès
2024-04-03 17:26 ` Christopher Baines
2024-02-20 19:42 ` Christopher Baines [this message]
2024-02-23 16:20 ` [bug#69291] [PATCH 3/5] scripts: substitute: Replace some leave calls with raise Ludovic Courtès
2024-02-20 19:42 ` [bug#69291] [PATCH 4/5] scripts: substitute: Untangle selecting fast vs small compressions Christopher Baines
2024-02-23 16:26 ` Ludovic Courtès
2024-04-03 17:28 ` Christopher Baines
2024-02-20 19:42 ` [bug#69291] [PATCH 5/5] scripts: substitute: Extract script specific output from download-nar Christopher Baines
2024-02-23 16:27 ` Ludovic Courtès
2024-04-03 17:30 ` Christopher Baines
2024-04-21 11:24 ` bug#69291: " Christopher Baines
2024-02-23 16:16 ` [bug#69291] [PATCH 1/5] scripts: substitute: Remove side effect warning from network-error? Ludovic Courtès
2024-04-04 14:06 ` [bug#69291] [PATCH v2 1/2] scripts: substitute: Untangle selecting fast vs small compressions Christopher Baines
2024-04-04 14:06 ` [bug#69291] [PATCH v2 2/2] scripts: substitute: Extract script specific output from download-nar Christopher Baines
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3a88dc8a8369278f86f3a51a99aa62d991ba997d.1708458147.git.mail@cbaines.net \
--to=mail@cbaines.net \
--cc=69291@debbugs.gnu.org \
--cc=dev@jpoiret.xyz \
--cc=guix@cbaines.net \
--cc=ludo@gnu.org \
--cc=me@tobias.gr \
--cc=othacehe@gnu.org \
--cc=rekado@elephly.net \
--cc=zimon.toutoune@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.