summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-06-15 23:18:46 +0200
committerLudovic Courtès <ludo@gnu.org>2021-06-18 14:18:06 +0200
commitf371972e788df6310e12d15914d70d834c9deadb (patch)
tree1716902eb89300b30f314171eb759b7bfcffbba1 /guix
parentbccf2a9e25bbd2f6125cdc4452352d743d323d97 (diff)
import: launchpad: Gracefully handle 404s from api.launchpad.net.
Fixes <https://bugs.gnu.org/49031>. Reported by Emad Alblueshi <emad.albloushi@gmail.com>. * guix/import/launchpad.scm (latest-released-version): Gracefully handle 'json-fetch' returning #f.
Diffstat (limited to 'guix')
-rw-r--r--guix/import/launchpad.scm17
1 files changed, 8 insertions, 9 deletions
diff --git a/guix/import/launchpad.scm b/guix/import/launchpad.scm
index fd3cfa8444..a52b39a085 100644
--- a/guix/import/launchpad.scm
+++ b/guix/import/launchpad.scm
@@ -110,15 +110,14 @@ for example, 'linuxdcpp'. Return #f if there is no releases."
char-set:digit)
(assoc-ref x "version"))))
- (assoc-ref
- (last (remove
- pre-release?
- (vector->list
- (assoc-ref (json-fetch
- (string-append "https://api.launchpad.net/1.0/"
- package-name "/releases"))
- "entries"))))
- "version"))
+ (match (json-fetch
+ (string-append "https://api.launchpad.net/1.0/"
+ package-name "/releases"))
+ (#f #f) ;404 or similar
+ (json
+ (assoc-ref
+ (last (remove pre-release? (vector->list (assoc-ref json "entries"))))
+ "version"))))
(define (latest-release pkg)
"Return an <upstream-source> for the latest release of PKG."