guix archive: Improve '--generate-key' error reporting.

* guix/scripts/archive.scm (%options) <generate-key>: Report the error
  source and string when 'string->canonical-sexp' fails.
master
Ludovic Courtès 2014-03-17 23:47:18 +01:00
parent aa2480e50d
commit d0a850698a
1 changed files with 4 additions and 3 deletions

View File

@ -114,9 +114,10 @@ Export/import one or more packages from/to the store.\n"))
(string->canonical-sexp
(or arg "(genkey (rsa (nbits 4:4096)))"))))
(alist-cons 'generate-key params result)))
(lambda args
(leave (_ "invalid key generation parameters: ~s~%")
arg)))))
(lambda (key err)
(leave (_ "invalid key generation parameters: ~a: ~a~%")
(error-source err)
(error-string err))))))
(option '("authorize") #f #f
(lambda (opt name arg result)
(alist-cons 'authorize #t result)))