Skip to content

Commit

Permalink
Better error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mj52951 committed Jul 10, 2024
1 parent a4226d3 commit 787ef50
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/start-init.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

yarn migration:generate && \
(yarn migration:generate || \
yarn migration:apply) && \
yarn migration:apply && \
node --require=dotenv/config ./lib/main_init.js
5 changes: 5 additions & 0 deletions src/evmIndexer/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ export async function parseDeposit(
const resource = fromDomain.resources.find(
(resource) => resource.resourceId == event.resourceID
)!;
if (!resource){
throw new Error(
`Resource with ID ${event.resourceID} not found in shared configuration`
);
}
const resourceType = resource.type || "";
const resourceDecimals = resource.decimals || 18;

Expand Down
5 changes: 5 additions & 0 deletions src/evmProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ export async function startEvmProcessing(
const toDomain = sharedConfig.domains.find(
(domain) => domain.id == event.destinationDomainID
);
if (!toDomain){
throw new Error(
`Destination domain with ID ${event.destinationDomainID} not found in shared configuration`
);
}
deposits.push(
await parseDeposit(
log,
Expand Down

0 comments on commit 787ef50

Please sign in to comment.