Skip to content

Commit

Permalink
improve(ArweaveClient): handle 404 errors (#722)
Browse files Browse the repository at this point in the history
Signed-off-by: bennett <bennett@umaproject.org>
  • Loading branch information
bmzig authored Sep 4, 2024
1 parent c0ef470 commit e74a59c
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/caching/Arweave/ArweaveClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,21 @@ export class ArweaveClient {
});
const results = await Promise.all(
entries.map(async (edge) => {
const data = await this.get<T>(edge.node.id, validator);
return isDefined(data)
? {
data,
hash: edge.node.id,
}
: null;
try {
const data = await this.get<T>(edge.node.id, validator);
return isDefined(data)
? {
data,
hash: edge.node.id,
}
: null;
} catch (e) {
this.logger.warn({
at: "ArweaveClient:getByTopic",
message: `Bad request for Arweave topic ${edge.node.id}: ${e}`,
});
return null;
}
})
);
return results.filter(isDefined);
Expand Down

0 comments on commit e74a59c

Please sign in to comment.