From d9aad9e906ae7a5ad26463aa63e4281c59b8f7a6 Mon Sep 17 00:00:00 2001 From: Ashwin Phatak Date: Thu, 27 May 2021 17:00:30 +0530 Subject: [PATCH] Return empty result instead of error if slot not found in storage table. --- pkg/graphql/graphql.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/graphql/graphql.go b/pkg/graphql/graphql.go index 6d5fbf71..3ef17b6f 100644 --- a/pkg/graphql/graphql.go +++ b/pkg/graphql/graphql.go @@ -19,6 +19,7 @@ package graphql import ( "context" + "database/sql" "errors" "time" @@ -981,6 +982,12 @@ func (r *Resolver) GetStorageAt(ctx context.Context, args struct { cid, ipldBlock, rlpValue, err := r.backend.IPLDRetriever.RetrieveStorageAtByAddressAndStorageKeyAndBlockHash(args.Contract, storageLeafKey, args.BlockHash) if err != nil { + if err == sql.ErrNoRows { + ret := StorageResult{value: ([]byte{}), cid: "", ipldBlock: ([]byte{})} + + return &ret, nil + } + return nil, err }