catch error

This commit is contained in:
mihaisc 2022-10-21 14:56:36 +03:00
parent a0d3c365bb
commit 0f65e72690

View File

@ -1,6 +1,6 @@
import { Dispenser } from '../../@types/schema' import { Dispenser } from '../../@types/schema'
import { getToken } from './tokenUtils' import { getToken } from './tokenUtils'
import { Address } from '@graphprotocol/graph-ts' import { Address, log } from '@graphprotocol/graph-ts'
import { weiToDecimal } from './generic' import { weiToDecimal } from './generic'
import { Dispenser as DispenserContract } from '../../@types/templates/Dispenser/Dispenser' import { Dispenser as DispenserContract } from '../../@types/templates/Dispenser/Dispenser'
@ -29,6 +29,7 @@ export function updateDispenserDetails(
contractAddress: Address, contractAddress: Address,
datatokenAddress: Address datatokenAddress: Address
): void { ): void {
try {
const dispenserID = getDispenserGraphID(contractAddress, datatokenAddress) const dispenserID = getDispenserGraphID(contractAddress, datatokenAddress)
const dispenser = getDispenser(dispenserID) const dispenser = getDispenser(dispenserID)
const contract = DispenserContract.bind(contractAddress) const contract = DispenserContract.bind(contractAddress)
@ -42,4 +43,10 @@ export function updateDispenserDetails(
dispenser.isMinter = dispenserDetails.value.value2 dispenser.isMinter = dispenserDetails.value.value2
dispenser.active = dispenserDetails.value.value0 dispenser.active = dispenserDetails.value.value0
dispenser.save() dispenser.save()
} catch (error) {
log.error(
'Failed to update dispenser details , address: {}, dtAddress: {}',
[contractAddress.toHexString(), datatokenAddress.toString()]
)
}
} }