Skip to content

Commit

Permalink
don't throw for failed zap parse
Browse files Browse the repository at this point in the history
  • Loading branch information
futurepaul authored and benthecarman committed Nov 8, 2023
1 parent affb885 commit 0b9a2b2
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions src/utils/fetchZaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,13 @@ export const fetchZaps: ResourceFetcher<

for (const object of data) {
if (object.kind === 10000113) {
const content = JSON.parse(object.content);
if (content?.until) {
newUntil = content?.until + 1;
try {
const content = JSON.parse(object.content);
if (content?.until) {
newUntil = content?.until + 1;
}
} catch (e) {
console.error("Failed to parse content: ", object.content);
}
}

Expand All @@ -212,14 +216,18 @@ export const fetchZaps: ResourceFetcher<
}

if (object.kind === 9735) {
const event = await simpleZapFromEvent(
object,
state.mutiny_wallet!
);

// Only add it if it's a valid zap (not undefined)
if (event) {
zaps.push(event);
try {
const event = await simpleZapFromEvent(
object,
state.mutiny_wallet!
);

// Only add it if it's a valid zap (not undefined)
if (event) {
zaps.push(event);
}
} catch (e) {
console.error("Failed to parse zap event: ", object);
}
}
}
Expand Down

0 comments on commit 0b9a2b2

Please sign in to comment.