1
0
Fork 0
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:
Henrik Hautakoski 2022-02-02 16:28:31 +01:00
parent c13b2d49c6
commit 0c876cea72

6
abi.go
View file

@ -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