Skip to content

Commit

Permalink
feat: error return in store
Browse files Browse the repository at this point in the history
  • Loading branch information
hea9549 committed Aug 19, 2020
1 parent c12adc5 commit 844b4fe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions keychain/mem/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ type MemStore struct {
keys map[string]keychain.Key
}

func (ks *MemStore) Store(k keychain.Key) {

func (ks *MemStore) Store(k keychain.Key) error {
panic("impl me!")
}

func (ks *MemStore) Get(id string) keychain.Key {
return keychain.Key{}
func (ks *MemStore) Get(id string) (keychain.Key, error) {
return keychain.Key{}, nil
}
4 changes: 2 additions & 2 deletions keychain/store.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package keychain

type Store interface {
Store(k Key)
Get(id string) Key
Store(k Key) error
Get(id string) (Key, error)
}
2 changes: 1 addition & 1 deletion server/api/walletapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (w *WalletApi) GetWallet(context *gin.Context) {
return
}

key := w.store.Get(request.ID)
key, err := w.store.Get(request.ID)
accounts, err := w.getAccounts(key)
if err != nil {
internalServerError(context, errors.New("failed to derive account"))
Expand Down

0 comments on commit 844b4fe

Please sign in to comment.