Don't fail on wrong log decoding (#5813)

This commit is contained in:
Nicolas Gotchac 2017-06-13 17:36:51 +02:00 committed by Gav Wood
parent 57479dac27
commit e4c7a7f30a

View File

@ -177,19 +177,26 @@ export default class Contract {
return null; return null;
} }
const decoded = event.decodeLog(log.topics, log.data); try {
const decoded = event.decodeLog(log.topics, log.data);
log.params = {}; log.params = {};
log.event = event.name; log.event = event.name;
decoded.params.forEach((param, index) => { decoded.params.forEach((param, index) => {
const { type, value } = param.token; const { type, value } = param.token;
const key = param.name || index; const key = param.name || index;
log.params[key] = { type, value }; log.params[key] = { type, value };
}); });
return log; return log;
} catch (error) {
console.warn('Error decoding log', log);
console.warn(error);
return null;
}
}) })
.filter((log) => log); .filter((log) => log);
} }