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

View file

@ -114,9 +114,10 @@ (define %options
(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)))