add more error messages for init command

This commit is contained in:
Andrea Franz 2018-11-06 13:04:00 +01:00
parent b813e1743f
commit 8be3d6ebcb
No known key found for this signature in database
GPG Key ID: 4F0D2F2D9DE7F29D
2 changed files with 11 additions and 2 deletions

View File

@ -162,6 +162,7 @@ func commandInstall(i *actionsets.Installer) error {
}
defer f.Close()
fmt.Printf("installation can take a while...\n")
err = i.Install(f, *flagOverwrite)
if err != nil {
fail("installation error", "error", err)

View File

@ -70,12 +70,20 @@ func (i *Installer) Init() (*lightwallet.Secrets, error) {
return nil, err
}
cardPubKey, err := actions.SelectNotInitialized(i.c, walletAID)
info, err := actions.Select(i.c, walletAID)
if err != nil {
return nil, err
}
err = actions.Init(i.c, cardPubKey, secrets, walletAID)
if !info.Installed {
return nil, fmt.Errorf("applet not installed")
}
if info.Initialized {
return nil, fmt.Errorf("card already initialized")
}
err = actions.Init(i.c, info.PublicKey, secrets, walletAID)
if err != nil {
return nil, err
}