From 47787c0b0b846d5f4a057661efdd05d8786032f1 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 6 Apr 2020 23:32:01 +0530 Subject: make linter less grumpy --- src/operations/pay.ts | 10 +++++----- src/operations/refund.ts | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src/operations') diff --git a/src/operations/pay.ts b/src/operations/pay.ts index 3a629e9c2..337068b55 100644 --- a/src/operations/pay.ts +++ b/src/operations/pay.ts @@ -620,7 +620,7 @@ export async function processDownloadProposal( proposalId: string, forceNow = false, ): Promise { - const onOpErr = (err: OperationError) => + const onOpErr = (err: OperationError): Promise => incrementProposalRetry(ws, proposalId, err); await guardOperationException( () => processDownloadProposalImpl(ws, proposalId, forceNow), @@ -631,7 +631,7 @@ export async function processDownloadProposal( async function resetDownloadProposalRetry( ws: InternalWalletState, proposalId: string, -) { +): Promise { await ws.db.mutate(Stores.proposals, proposalId, (x) => { if (x.retryInfo.active) { x.retryInfo = initRetryInfo(); @@ -1108,7 +1108,7 @@ export async function processPurchasePay( proposalId: string, forceNow = false, ): Promise { - const onOpErr = (e: OperationError) => + const onOpErr = (e: OperationError): Promise => incrementPurchasePayRetry(ws, proposalId, e); await guardOperationException( () => processPurchasePayImpl(ws, proposalId, forceNow), @@ -1119,7 +1119,7 @@ export async function processPurchasePay( async function resetPurchasePayRetry( ws: InternalWalletState, proposalId: string, -) { +): Promise { await ws.db.mutate(Stores.purchases, proposalId, (x) => { if (x.payRetryInfo.active) { x.payRetryInfo = initRetryInfo(); @@ -1150,7 +1150,7 @@ async function processPurchasePayImpl( export async function refuseProposal( ws: InternalWalletState, proposalId: string, -) { +): Promise { const success = await ws.db.runWithWriteTransaction( [Stores.proposals], async (tx) => { diff --git a/src/operations/refund.ts b/src/operations/refund.ts index 74d4b848e..af9a48895 100644 --- a/src/operations/refund.ts +++ b/src/operations/refund.ts @@ -302,7 +302,7 @@ export async function processPurchaseQueryRefund( proposalId: string, forceNow = false, ): Promise { - const onOpErr = (e: OperationError) => + const onOpErr = (e: OperationError): Promise => incrementPurchaseQueryRefundRetry(ws, proposalId, e); await guardOperationException( () => processPurchaseQueryRefundImpl(ws, proposalId, forceNow), @@ -313,7 +313,7 @@ export async function processPurchaseQueryRefund( async function resetPurchaseQueryRefundRetry( ws: InternalWalletState, proposalId: string, -) { +): Promise { await ws.db.mutate(Stores.purchases, proposalId, (x) => { if (x.refundStatusRetryInfo.active) { x.refundStatusRetryInfo = initRetryInfo(); @@ -368,7 +368,7 @@ export async function processPurchaseApplyRefund( proposalId: string, forceNow = false, ): Promise { - const onOpErr = (e: OperationError) => + const onOpErr = (e: OperationError): Promise => incrementPurchaseApplyRefundRetry(ws, proposalId, e); await guardOperationException( () => processPurchaseApplyRefundImpl(ws, proposalId, forceNow), @@ -379,7 +379,7 @@ export async function processPurchaseApplyRefund( async function resetPurchaseApplyRefundRetry( ws: InternalWalletState, proposalId: string, -) { +): Promise { await ws.db.mutate(Stores.purchases, proposalId, (x) => { if (x.refundApplyRetryInfo.active) { x.refundApplyRetryInfo = initRetryInfo(); @@ -435,11 +435,10 @@ async function processPurchaseApplyRefundImpl( // We're too late, refund is expired. newRefundsFailed[pk] = info; break; - default: + default: { let body: string | null = null; - try { - body = await resp.json(); - } catch {} + // FIXME: error handling! + body = await resp.json(); const m = "refund request (at exchange) failed"; throw new OperationFailedError({ message: m, @@ -448,6 +447,7 @@ async function processPurchaseApplyRefundImpl( body, }, }); + } } } let allRefundsProcessed = false; -- cgit v1.2.3