summaryrefslogtreecommitdiff
path: root/guix/ui.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix/ui.scm')
-rw-r--r--guix/ui.scm6
1 files changed, 6 insertions, 0 deletions
diff --git a/guix/ui.scm b/guix/ui.scm
index 6d81475812..cf94aa0818 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -38,6 +38,7 @@
leave
show-version-and-exit
show-bug-report-information
+ string->number*
show-what-to-build
call-with-error-handling
with-error-handling
@@ -134,6 +135,11 @@ Report bugs to: ~a.") %guix-bug-report-address)
General help using GNU software: <http://www.gnu.org/gethelp/>"))
(newline))
+(define (string->number* str)
+ "Like `string->number', but error out with an error message on failure."
+ (or (string->number str)
+ (leave (_ "~a: invalid number~%") str)))
+
(define (call-with-error-handling thunk)
"Call THUNK within a user-friendly error handler."
(guard (c ((package-input-error? c)