[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
44/155: import cran: Handle HTTP errors.
From: |
John Darrington |
Subject: |
44/155: import cran: Handle HTTP errors. |
Date: |
Wed, 21 Dec 2016 20:48:32 +0000 (UTC) |
jmd pushed a commit to branch wip-installer
in repository guix.
commit 35e1035f90393e377e3021461f84ba50553788ae
Author: Ricardo Wurmus <address@hidden>
Date: Sat Dec 17 15:24:45 2016 +0100
import cran: Handle HTTP errors.
Fixes <http://bugs.gnu.org/23479>.
* guix/import/cran.scm (fetch-description): Return #f in case of HTTP
errors.
---
guix/import/cran.scm | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index 123abfe..463a255 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -23,8 +23,10 @@
#:use-module ((ice-9 rdelim) #:select (read-string))
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
+ #:use-module (srfi srfi-34)
#:use-module (srfi srfi-41)
#:use-module (ice-9 receive)
+ #:use-module (web uri)
#:use-module (guix combinators)
#:use-module (guix http-client)
#:use-module (guix hash)
@@ -128,10 +130,18 @@ package definition."
(define (fetch-description base-url name)
"Return an alist of the contents of the DESCRIPTION file for the R package
-NAME, or #f on failure. NAME is case-sensitive."
+NAME, or #f in case of failure. NAME is case-sensitive."
;; This API always returns the latest release of the module.
(let ((url (string-append base-url name "/DESCRIPTION")))
- (description->alist (read-string (http-fetch url)))))
+ (guard (c ((http-get-error? c)
+ (format (current-error-port)
+ "error: failed to retrieve package information \
+from ~s: ~a (~s)~%"
+ (uri->string (http-get-error-uri c))
+ (http-get-error-code c)
+ (http-get-error-reason c))
+ #f))
+ (description->alist (read-string (http-fetch url))))))
(define (listify meta field)
"Look up FIELD in the alist META. If FIELD contains a comma-separated
- 12/155: installer: Add gurses modules., (continued)
- 12/155: installer: Add gurses modules., John Darrington, 2016/12/21
- 35/155: import cran: Translate MIT to the Expat license., John Darrington, 2016/12/21
- 27/155: gnu: Add emacs-bui., John Darrington, 2016/12/21
- 47/155: gnu: sane-backends: Disable backend generation., John Darrington, 2016/12/21
- 17/155: gnu: tor: Recommend torsocks., John Darrington, 2016/12/21
- 10/155: installer: Perform a task's dependencies prior to the task itself., John Darrington, 2016/12/21
- 28/155: gnu: Add emacs-guix., John Darrington, 2016/12/21
- 30/155: gnu: star: Update to 2.5.2b., John Darrington, 2016/12/21
- 46/155: gnu: pinentry: Update to 1.0.0., John Darrington, 2016/12/21
- 52/155: gnu: r: Update to 3.3.2., John Darrington, 2016/12/21
- 44/155: import cran: Handle HTTP errors.,
John Darrington <=
- 26/155: gnu: imagemagick: Update to 6.9.6-8., John Darrington, 2016/12/21
- 40/155: import cran: Ignore default R packages., John Darrington, 2016/12/21
- 50/155: gnu: sane-backends: Remove timestamps from the output., John Darrington, 2016/12/21
- 39/155: import cran: description->package: Also return package dependencies., John Darrington, 2016/12/21
- 45/155: gnu: npth: Update to 1.3., John Darrington, 2016/12/21
- 42/155: import cran: Add "recursive" option., John Darrington, 2016/12/21
- 32/155: profiles: Remove dependency on 'glibc-utf8-locales' for tests., John Darrington, 2016/12/21
- 31/155: gnu: bootstrap: Add FTP URL for bootstrap binaries., John Darrington, 2016/12/21
- 53/155: gnu: youtube-dl: Update to 2016.12.15., John Darrington, 2016/12/21
- 49/155: gnu: Add and use sane-backends., John Darrington, 2016/12/21