From 3f8d1adc9776d13a707cfc91ac53dd7b056e201b Mon Sep 17 00:00:00 2001 From: Le Dien Phuc Date: Fri, 1 Dec 2023 16:05:24 +0700 Subject: [PATCH] fix(follow-tip): handle error (#1539) --- src/commands/tip/index/processor.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/commands/tip/index/processor.ts b/src/commands/tip/index/processor.ts index e54db3199..6092abad9 100644 --- a/src/commands/tip/index/processor.ts +++ b/src/commands/tip/index/processor.ts @@ -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, }) } @@ -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), @@ -494,6 +499,8 @@ export async function handleConfirmFollowTip(i: ButtonInteraction) { msgOrInteraction: i, description: logTransfer, curl: curlTransfer, + error: errorTransfer, + status: statusTransfer, }) } } @@ -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, }) } @@ -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), @@ -642,6 +654,8 @@ export async function handleCustomFollowTip(i: ButtonInteraction) { msgOrInteraction: i, description: logTransfer, curl: curlTransfer, + status: statusTransfer, + error: errorTransfer, }) } }