1
0
Fork 0
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:
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 ( 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