Skip to content

Commit

Permalink
fix(follow-tip): handle error (#1539)
Browse files Browse the repository at this point in the history
  • Loading branch information
phucledien authored Dec 1, 2023
1 parent e4ceab9 commit 3f8d1ad
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/commands/tip/index/processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,12 +417,16 @@ export async function handleConfirmFollowTip(i: ButtonInteraction) {
data: followTx,
ok,
curl,
status = 500,
error,
} = await mochiPay.getTxByExternalId(followTxId)
if (!ok) {
throw new APIError({
msgOrInteraction: i,
description: "Cannot get transaction",
curl,
status,
error,
})
}

Expand Down Expand Up @@ -472,7 +476,8 @@ export async function handleConfirmFollowTip(i: ButtonInteraction) {
ok: okTransfer,
curl: curlTransfer,
log: logTransfer,
status: statusTransfer,
status: statusTransfer = 500,
error: errorTransfer,
} = await defi.transferV2({
...payload,
sender: await getProfileIdByDiscord(payload.sender),
Expand All @@ -494,6 +499,8 @@ export async function handleConfirmFollowTip(i: ButtonInteraction) {
msgOrInteraction: i,
description: logTransfer,
curl: curlTransfer,
error: errorTransfer,
status: statusTransfer,
})
}
}
Expand Down Expand Up @@ -564,12 +571,16 @@ export async function handleCustomFollowTip(i: ButtonInteraction) {
data: followTx,
ok,
curl,
status = 500,
error,
} = await mochiPay.getTxByExternalId(followTxId)
if (!ok) {
throw new APIError({
msgOrInteraction: i,
description: "Cannot get transaction",
curl,
status,
error,
})
}

Expand Down Expand Up @@ -620,7 +631,8 @@ export async function handleCustomFollowTip(i: ButtonInteraction) {
ok: okTransfer,
curl: curlTransfer,
log: logTransfer,
status: statusTransfer,
status: statusTransfer = 500,
error: errorTransfer,
} = await defi.transferV2({
...payload,
sender: await getProfileIdByDiscord(payload.sender),
Expand All @@ -642,6 +654,8 @@ export async function handleCustomFollowTip(i: ButtonInteraction) {
msgOrInteraction: i,
description: logTransfer,
curl: curlTransfer,
status: statusTransfer,
error: errorTransfer,
})
}
}
Expand Down

0 comments on commit 3f8d1ad

Please sign in to comment.