fix: return nil response for gql queries
This commit is contained in:
parent
555934b799
commit
2b8b18d659
@ -78,9 +78,8 @@ func (q queryResolver) ResolveNames(ctx context.Context, names []string) ([]*Rec
|
||||
for _, name := range names {
|
||||
res, err := nsQueryClient.ResolveWrn(context.Background(), &nstypes.QueryResolveWrn{Wrn: name})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
gqlResponse = append(gqlResponse, nil)
|
||||
} else {
|
||||
gqlRecord, err := getGQLRecord(context.Background(), q, *res.GetRecord())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -88,6 +87,7 @@ func (q queryResolver) ResolveNames(ctx context.Context, names []string) ([]*Rec
|
||||
|
||||
gqlResponse = append(gqlResponse, gqlRecord)
|
||||
}
|
||||
}
|
||||
|
||||
return gqlResponse, nil
|
||||
}
|
||||
@ -99,9 +99,9 @@ func (q queryResolver) LookupNames(ctx context.Context, names []string) ([]*Name
|
||||
for _, name := range names {
|
||||
res, err := nsQueryClient.LookupWrn(context.Background(), &nstypes.QueryLookupWrn{Wrn: name})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Instead of throwing error for name not found, return nil similar to https://github.com/vulcanize/dxns/blob/main/gql/resolver.go#L191
|
||||
gqlResponse = append(gqlResponse, nil)
|
||||
} else {
|
||||
gqlRecord, err := getGQLNameRecord(res.GetName())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -109,6 +109,7 @@ func (q queryResolver) LookupNames(ctx context.Context, names []string) ([]*Name
|
||||
|
||||
gqlResponse = append(gqlResponse, gqlRecord)
|
||||
}
|
||||
}
|
||||
|
||||
return gqlResponse, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user