mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-16 04:24:56 +02:00
abi.go: in GetAbi: wrap error message so we know if api or redis failed.
This commit is contained in:
parent
c13b2d49c6
commit
0c876cea72
1 changed files with 4 additions and 2 deletions
6
abi.go
6
abi.go
|
|
@ -3,6 +3,8 @@ package main
|
|||
|
||||
import (
|
||||
"time"
|
||||
"errors"
|
||||
"fmt"
|
||||
"encoding/json"
|
||||
eos "github.com/eoscanada/eos-go"
|
||||
redis_cache "github.com/go-redis/cache/v8"
|
||||
|
|
@ -28,13 +30,13 @@ func GetAbi(account eos.AccountName) (*eos.ABI, error) {
|
|||
if err != nil {
|
||||
resp, err := eosClient.GetABI(eosClientCtx, account)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, errors.New(fmt.Sprintf("api: %s", err))
|
||||
}
|
||||
abi = &resp.ABI
|
||||
|
||||
err = abiCache.Set(key, abi, time.Hour)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, errors.New(fmt.Sprintf("cache: %s", err))
|
||||
}
|
||||
}
|
||||
return abi, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue