From 4c5edee1ef2aff2b8f3782ccb03723a6428bf600 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 25 Aug 2020 14:49:34 +0200 Subject: lint: Use 'with-error-handling'. This improves the error message when unable to access ~/.cache as reported by Jonathan Brielmaier in . * guix/scripts/lint.scm (guix-lint): Wrap body in 'with-error-handling'. --- guix/scripts/lint.scm | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'guix/scripts/lint.scm') diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm index 97ffd57301..5168a1ca17 100644 --- a/guix/scripts/lint.scm +++ b/guix/scripts/lint.scm @@ -1,7 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014 Cyril Roelandt ;;; Copyright © 2014, 2015 Eric Bavier -;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès ;;; Copyright © 2015, 2016 Mathieu Lirzin ;;; Copyright © 2016 Danny Milosavljevic ;;; Copyright © 2016 Hartmut Goebel @@ -174,23 +174,24 @@ run the checkers on all packages.\n")) (when (assoc-ref opts 'list?) (list-checkers-and-exit checkers)) - (let ((any-lint-checker-requires-store? - (any lint-checker-requires-store? checkers))) - - (define (call-maybe-with-store proc) - (if any-lint-checker-requires-store? - (with-store store - (proc store)) - (proc #f))) - - (call-maybe-with-store - (lambda (store) - (cond - ((null? args) - (fold-packages (lambda (p r) (run-checkers p checkers - #:store store)) '())) - (else - (for-each (lambda (spec) - (run-checkers (specification->package spec) checkers - #:store store)) - args)))))))) + (with-error-handling + (let ((any-lint-checker-requires-store? + (any lint-checker-requires-store? checkers))) + + (define (call-maybe-with-store proc) + (if any-lint-checker-requires-store? + (with-store store + (proc store)) + (proc #f))) + + (call-maybe-with-store + (lambda (store) + (cond + ((null? args) + (fold-packages (lambda (p r) (run-checkers p checkers + #:store store)) '())) + (else + (for-each (lambda (spec) + (run-checkers (specification->package spec) checkers + #:store store)) + args))))))))) -- cgit v1.2.3