Skip to content

Commit

Permalink
feat(token): add get tokens error logging
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Lahaye <[email protected]>
  • Loading branch information
ChrisLahaye committed Dec 5, 2023
1 parent 9e053bb commit 38f2354
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/graphql/resolvers/token.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Arg, Args, Resolver, Info, Root, Query, Subscription, Int } from 'type-graphql';
import { Arg, Args, Ctx, Resolver, Info, Root, Query, Subscription, Int } from 'type-graphql';
import { GraphQLResolveInfo } from 'graphql';
import * as assert from 'assert';

import type { Context } from '../types';

import { OrderDirection, Token_orderBy } from '../../lib/lemonade-marketplace/types.generated';
import { PaginationArgs } from '../types/pagination';
import { TokenDetail, TokenSort, TokenComplex, TokenWhereComplex } from '../types/token';
Expand Down Expand Up @@ -86,6 +88,7 @@ class _TokensQueryResolver {

@Query(() => [TokenComplex])
async getTokens(
@Ctx() { logger }: Context,
@Args() { skip, limit }: PaginationArgs,
@Arg('network', () => String, { nullable: true }) network?: string,
@Arg('id', () => String, { nullable: true }) id?: string,
Expand All @@ -111,7 +114,11 @@ class _TokensQueryResolver {
}

const tokens = await Promise.all(networks.map((network) =>
getTokens(network, variables).catch(() => [])
getTokens(network, variables).catch((err) => {
logger.debug({ network: network.name, err }, 'failed to get tokens');

return [];
})
));

return tokens.flat().sort((a, b) =>
Expand Down

0 comments on commit 38f2354

Please sign in to comment.