Subject: [PATCH] guix: import: composer: Handle parsing failures.

From: Nicolas Graves <[email-masked]>
Date: Tue, 19 Dec 2023 12:19:31 +0100

* guix/import/composer (latest-release): Handle parsing failures.

Change-Id: I14936c2c6e6a850a32fe56891766ae92b693a295
---
 guix/import/composer.scm | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/guix/import/composer.scm b/guix/import/composer.scm
index 069a950f90..b40285620d 100644
--- a/guix/import/composer.scm
+++ b/guix/import/composer.scm
@@ -246,13 +246,18 @@ (define (php-package? package)
 (define* (latest-release package #:key (version #f))
   "Return an <upstream-source> for the latest release of PACKAGE."
   (let* ((php-name (guix-package->composer-name package))
-         (package (composer-fetch php-name #:version version))
-         (version (composer-package-version package))
-         (url (composer-source-url (composer-package-source package))))
-    (upstream-source
-     (package (composer-package-name package))
-     (version version)
-     (urls (list url)))))
+         (package (composer-fetch php-name #:version version)))
+    (match package
+      (#f
+       (format (current-error-port)
+               "warning: failed to parse ~a~%"
+               php-name)
+       #f)
+      (_
+       (upstream-source
+        (package (composer-package-name package))
+        (version (composer-package-version package))
+        (urls (composer-source-url (composer-package-source package))))))))
 
 (define %composer-updater
   (upstream-updater
-- 
2.41.0