guix_mirror_bot pushed a commit to branch master
in repository guix.
commit 758e79730cb13de49b95d0ec3eb1c83766166c94
Author: Simon Tournier <[email protected]>
AuthorDate: Thu Jul 17 01:53:49 2025 +0200
swh: Catch swh-error when downloading from SWH Vault.
* guix/swh.scm (swh-download): Catch 'swh-error' and display the error
message.
Change-Id: I2965d8b71023a938a5ba7eba454c6ec109fdcc54
Signed-off-by: Ludovic Courtès <[email protected]>
---
guix/swh.scm | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/guix/swh.scm b/guix/swh.scm
index fd17b04b75..038895904a 100644
--- a/guix/swh.scm
+++ b/guix/swh.scm
@@ -2,7 +2,7 @@
;;; Copyright © 2018-2021, 2024 Ludovic Courtès <[email protected]>
;;; Copyright © 2020 Jakub Kądziołka <[email protected]>
;;; Copyright © 2021 Xinglu Chen <[email protected]>
-;;; Copyright © 2021 Simon Tournier <[email protected]>
+;;; Copyright © 2021, 2025 Simon Tournier <[email protected]>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -802,9 +802,13 @@ and #f on failure.
This procedure uses the \"vault\", which contains \"cooked\" directories in
the form of tarballs. If the requested directory is not cooked yet, it will
wait until it becomes available, which could take several minutes."
- (match (if (commit-id? reference)
- (lookup-revision reference)
- (lookup-origin-revision url reference))
+ (match (catch 'swh-error
+ (lambda ()
+ (if (commit-id? reference)
+ (lookup-revision reference)
+ (lookup-origin-revision url reference)))
+ (lambda (key url method response)
+ response))
((? revision? revision)
(format log-port "SWH: found revision ~a with directory at '~a'~%"
(revision-id revision)
@@ -819,6 +823,11 @@ wait until it becomes available, which could take several
minutes."
output
#:archive-type archive-type
#:log-port log-port))
+ ((? response? response)
+ (format log-port
+ "SWH: error: ~a~%"
+ (response-reason-phrase response))
+ #f)
(#f
(format log-port
"SWH: revision ~s originating from ~a could not be found~%"