Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch error when event doesn't have a matching messsage #156

Merged
merged 3 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]
### Fixed
- Logs with a missing message throwing an error (#156)
- Test command not working because of dependency issue (#155)

## [2.10.0] - 2023-07-31
Expand Down
10 changes: 9 additions & 1 deletion packages/node/src/utils/cosmos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,15 @@ export function wrapEvent(
continue;
}
for (const log of logs) {
const msg = wrapCosmosMsg(block, tx, log.msg_index, api);
let msg: CosmosMessage;
try {
msg = wrapCosmosMsg(block, tx, log.msg_index, api);
} catch (e) {
// Example where this can happen https://sei.explorers.guru/transaction/8D4CA68E917E15652E10CB960DE604AEEB1B183D6E94A85E9CD98403F15550B7
logger.warn(
`Unable to find message for event. tx=${tx.hash} messageIdx=${log.msg_index}`,
);
}
for (let i = 0; i < log.events.length; i++) {
const event: CosmosEvent = {
idx: idxOffset++,
Expand Down
Loading