mirror of
https://github.com/eosswedenorg/thalos
synced 2026-07-02 11:43:40 +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 (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
eos "github.com/eoscanada/eos-go"
|
eos "github.com/eoscanada/eos-go"
|
||||||
redis_cache "github.com/go-redis/cache/v8"
|
redis_cache "github.com/go-redis/cache/v8"
|
||||||
|
|
@ -28,13 +30,13 @@ func GetAbi(account eos.AccountName) (*eos.ABI, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
resp, err := eosClient.GetABI(eosClientCtx, account)
|
resp, err := eosClient.GetABI(eosClientCtx, account)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, errors.New(fmt.Sprintf("api: %s", err))
|
||||||
}
|
}
|
||||||
abi = &resp.ABI
|
abi = &resp.ABI
|
||||||
|
|
||||||
err = abiCache.Set(key, abi, time.Hour)
|
err = abiCache.Set(key, abi, time.Hour)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, errors.New(fmt.Sprintf("cache: %s", err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return abi, nil
|
return abi, nil
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue