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.
This commit is contained in:
Ludovic Courtès 2014-03-17 23:47:18 +01:00
parent aa2480e50d
commit d0a850698a

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