From f371972e788df6310e12d15914d70d834c9deadb Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 15 Jun 2021 23:18:46 +0200 Subject: import: launchpad: Gracefully handle 404s from api.launchpad.net. Fixes . Reported by Emad Alblueshi . * guix/import/launchpad.scm (latest-released-version): Gracefully handle 'json-fetch' returning #f. --- guix/import/launchpad.scm | 17 ++++++++--------- 1 file 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 @@ (define (pre-release? x) 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 for the latest release of PKG." -- cgit v1.2.3