summaryrefslogtreecommitdiff
path: root/guix/ui.scm
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2018-03-16 18:29:31 -0400
committerMark H Weaver <mhw@netris.org>2018-03-16 20:02:47 -0400
commitcbdfa50d9fb19704caa60818d7635047a6a26d71 (patch)
tree433fdbfd04fe0850f3a2d8904de53c4f2c1605d0 /guix/ui.scm
parent23c0d40e1312663ef553ba7b6415a0ac483b591e (diff)
utils: invoke: Raise exceptions using SRFI-34 and SRFI-35.
* guix/build/utils.scm (&invoke-error): New condition type. (invoke-error?, invoke-error-program, invoke-error-arguments) (invoke-error-exit-status, invoke-error-term-signal) (invoke-error-stop-signal): New exported procedures. (invoke): Raise exceptions using SRFI-34 and SRFI-35. * guix/ui.scm (call-with-error-handling): Add a guard clause for &invoke-error conditions.
Diffstat (limited to 'guix/ui.scm')
-rw-r--r--guix/ui.scm18
1 files changed, 17 insertions, 1 deletions
diff --git a/guix/ui.scm b/guix/ui.scm
index cb49a15c4d..c6d0704cfa 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
-;;; Copyright © 2013 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2013, 2018 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2014 Cyril Roelandt <tipecaml@gmail.com>
;;; Copyright © 2014 Cyrill Schenkel <cyrill.schenkel@gmail.com>
@@ -41,6 +41,12 @@
#:use-module ((guix licenses) #:select (license? license-name))
#:use-module ((guix build syscalls)
#:select (free-disk-space terminal-columns))
+ #:use-module ((guix build utils)
+ #:select (invoke-error? invoke-error-program
+ invoke-error-arguments
+ invoke-error-exit-status
+ invoke-error-term-signal
+ invoke-error-stop-signal))
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-11)
#:use-module (srfi srfi-19)
@@ -636,6 +642,16 @@ or remove one of them from the profile.")
directories:~{ ~a~}~%")
(file-search-error-file-name c)
(file-search-error-search-path c)))
+ ((invoke-error? c)
+ (leave (G_ "program exited\
+~@[ with non-zero exit status ~a~]\
+~@[ terminated by signal ~a~]\
+~@[ stopped by signal ~a~]: ~s~%")
+ (invoke-error-exit-status c)
+ (invoke-error-term-signal c)
+ (invoke-error-stop-signal c)
+ (cons (invoke-error-program c)
+ (invoke-error-arguments c))))
((and (error-location? c) (message-condition? c))
(format (current-error-port)
(G_ "~a: error: ~a~%")