import: cpan: Gracefully handle missing projects.

* guix/import/cpan.scm (cpan-fetch): Check whether 'json-fetch' returns #f.
This commit is contained in:
Ludovic Courtès 2020-03-12 11:18:40 +01:00
parent 2d0409a4a2
commit c00ae79cca
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5

@ -181,9 +181,9 @@ return \"Test-Simple\""
or #f on failure. MODULE should be the distribution name, such as
\"Test-Script\" for the \"Test::Script\" module."
;; This API always returns the latest release of the module.
(json->cpan-release
(json-fetch (string-append (%metacpan-base-url) "/release/"
name))))
(and=> (json-fetch (string-append (%metacpan-base-url) "/release/"
name))
json->cpan-release))
(define (cpan-home name)
(string-append "https://metacpan.org/release/" name))