Skip to content

Commit

Permalink
fix: erc20tracker: improve logging
Browse files Browse the repository at this point in the history
Resolves BACK-840.
  • Loading branch information
Louis-Amas committed Dec 16, 2022
1 parent f738ede commit 72a2d37
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/lib/generics-events-subscribers/erc20-event-subscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
} from '../tokens/types';
import { ERC20Event, ERC20StateMap, WrappedEvent } from './types';
import { CACHE_PREFIX } from '../../constants';
import { catchParseLogError } from '../../utils';

export class ERC20EventSubscriber extends StatefulEventSubscriber<ERC20StateMap> {
private walletAddresses: Set<string> = new Set<string>();
Expand Down Expand Up @@ -121,10 +122,13 @@ export class ERC20EventSubscriber extends StatefulEventSubscriber<ERC20StateMap>
log: Readonly<Log>,
blockHeader: Readonly<BlockHeader>,
): DeepReadonly<ERC20StateMap> | null {
const event = erc20Iface.parseLog(log);

if (event.name in this.handlers) {
return this.handlers[event.name](event, state);
try {
const event = erc20Iface.parseLog(log);
if (event.name in this.handlers) {
return this.handlers[event.name](event, state);
}
} catch (e) {
catchParseLogError(e, this.logger);
}

return null;
Expand Down

0 comments on commit 72a2d37

Please sign in to comment.