aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-12-30 18:23:44 +0100
committerLudovic Courtès <ludo@gnu.org>2013-12-30 18:23:44 +0100
commitc909dab2697d90a82c388e5efa8dab0001d09938 (patch)
treed3de67f1cce0e98510e97a1e1bdabdf0ef3e222e
parent6fc04984d20f2366457dc0b083e8206349848608 (diff)
downloadguix-c909dab2697d90a82c388e5efa8dab0001d09938.tar.gz
guix-c909dab2697d90a82c388e5efa8dab0001d09938.zip
authenticate: Consistently use 'leave' for fatal error reporting.
* guix/scripts/authenticate.scm (guix-authenticate): Replace all uses of 'format' + 'exit' with 'leave'.
-rw-r--r--guix/scripts/authenticate.scm26
1 files changed, 9 insertions, 17 deletions
diff --git a/guix/scripts/authenticate.scm b/guix/scripts/authenticate.scm
index cefa035953..c7a14f7a8b 100644
--- a/guix/scripts/authenticate.scm
+++ b/guix/scripts/authenticate.scm
@@ -61,8 +61,9 @@
(public-key (if (string-suffix? ".sec" key)
(read-canonical-sexp
(string-append (string-drop-right key 4) ".pub"))
- (leave (_ "cannot find public key for secret key '~a'")
- key)))
+ (leave
+ (_ "cannot find public key for secret key '~a'~%")
+ key)))
(data (read-hash-data hash-file))
(signature (signature-sexp data secret-key public-key)))
(display (canonical-sexp->string signature))
@@ -82,21 +83,12 @@
(display (bytevector->base16-string
(hash-data->bytevector data)))
#t) ; success
- (begin
- (format (current-error-port)
- "error: invalid signature: ~a~%"
- (canonical-sexp->string signature))
- (exit 1)))
- (begin
- (format (current-error-port)
- "error: unauthorized public key: ~a~%"
- (canonical-sexp->string public-key))
- (exit 1)))
- (begin
- (format (current-error-port)
- "error: corrupt signature data: ~a~%"
- (canonical-sexp->string sig+data))
- (exit 1)))))
+ (leave (_ "error: invalid signature: ~a~%")
+ (canonical-sexp->string signature)))
+ (leave (_ "error: unauthorized public key: ~a~%")
+ (canonical-sexp->string public-key)))
+ (leave (_ "error: corrupt signature data: ~a~%")
+ (canonical-sexp->string sig+data)))))
(("--help")
(display (_ "Usage: guix authenticate OPTION...
Sign or verify the signature on the given file. This tool is meant to