substitute: Do not unwind stack traces upon uncaught exceptions.

This is similar to commit a168c3e4f8.

* guix/scripts/substitute.scm (with-networking): Use
'with-throw-handler' instead of 'catch'.
This commit is contained in:
Ludovic Courtès 2021-02-23 17:01:24 +01:00
parent b288d0e749
commit e2572aa950
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014 Nikita Karetnikov <nikita@karetnikov.org> ;;; Copyright © 2014 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2018 Kyle Meyer <kyle@kyleam.com> ;;; Copyright © 2018 Kyle Meyer <kyle@kyleam.com>
;;; Copyright © 2020 Christopher Baines <mail@cbaines.net> ;;; Copyright © 2020 Christopher Baines <mail@cbaines.net>
@ -510,7 +510,9 @@ (define-syntax with-networking
;; lookup errors are typically the first one, and because other errors are ;; lookup errors are typically the first one, and because other errors are
;; a subset of `system-error', which is harder to filter. ;; a subset of `system-error', which is harder to filter.
((_ exp ...) ((_ exp ...)
(catch #t ;; Use a pre-unwind handler so that re-throwing preserves useful
;; backtraces. 'with-throw-handler' works for Guile 2.2 and 3.0.
(with-throw-handler #t
(lambda () exp ...) (lambda () exp ...)
(match-lambda* (match-lambda*
(('getaddrinfo-error error) (('getaddrinfo-error error)