diff options
author | Fabio Berger <me@fabioberger.com> | 2018-06-27 17:55:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-27 17:55:04 +0800 |
commit | f6e97bb284e7fbe1d220ecdfcda91a7e549057ac (patch) | |
tree | 4ae2e66f34aede11878e565b25f0e552ed7810c3 /packages/utils/src/abi_decoder.ts | |
parent | 84bd54ba4025a33f4e311ec66d81d58b45e54d6b (diff) | |
parent | 6c8b99850529cb1403a09327a0088c2d5b43cba7 (diff) | |
download | dexon-sol-tools-f6e97bb284e7fbe1d220ecdfcda91a7e549057ac.tar dexon-sol-tools-f6e97bb284e7fbe1d220ecdfcda91a7e549057ac.tar.gz dexon-sol-tools-f6e97bb284e7fbe1d220ecdfcda91a7e549057ac.tar.bz2 dexon-sol-tools-f6e97bb284e7fbe1d220ecdfcda91a7e549057ac.tar.lz dexon-sol-tools-f6e97bb284e7fbe1d220ecdfcda91a7e549057ac.tar.xz dexon-sol-tools-f6e97bb284e7fbe1d220ecdfcda91a7e549057ac.tar.zst dexon-sol-tools-f6e97bb284e7fbe1d220ecdfcda91a7e549057ac.zip |
Merge pull request #763 from prettymuchbryce/invalid-argument-error
Fix OrderWatcher uncaught Error
Diffstat (limited to 'packages/utils/src/abi_decoder.ts')
-rw-r--r-- | packages/utils/src/abi_decoder.ts | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts index 931cb94b2..d0c1ddc7d 100644 --- a/packages/utils/src/abi_decoder.ts +++ b/packages/utils/src/abi_decoder.ts @@ -32,7 +32,20 @@ export class AbiDecoder { const decodedParams: DecodedLogArgs = {}; let topicsIndex = 1; - const decodedData = ethersInterface.events[event.name].parse(log.data); + let decodedData: any[]; + try { + decodedData = ethersInterface.events[event.name].parse(log.data); + } catch (error) { + if (error.code === ethers.errors.INVALID_ARGUMENT) { + // Because we index events by Method ID, and Method IDs are derived from the method + // name and the input parameters, it's possible that the return value of the event + // does not match our ABI. If that's the case, then ethers will throw an error + // when we try to parse the event. We handle that case here by returning the log rather + // than throwing an error. + return log; + } + throw error; + } let didFailToDecode = false; _.forEach(event.inputs, (param: EventParameter, i: number) => { |