From 3b5c5f4a9d55cec9db2687f81042cedeb6f6321f Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 21 Feb 2024 17:13:44 -0300 Subject: wip #8371 --- packages/taler-wallet-core/src/wallet.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'packages/taler-wallet-core') diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts index 17fd74178..7eac73827 100644 --- a/packages/taler-wallet-core/src/wallet.ts +++ b/packages/taler-wallet-core/src/wallet.ts @@ -480,9 +480,9 @@ async function dumpCoins(ws: InternalWalletState): Promise { ageCommitmentProof: c.ageCommitmentProof, spend_allocation: c.spendAllocation ? { - amount: c.spendAllocation.amount, - id: c.spendAllocation.id, - } + amount: c.spendAllocation.amount, + id: c.spendAllocation.id, + } : undefined, }); } @@ -1524,8 +1524,15 @@ export class InternalWalletState { const myVersionChange = async (): Promise => { logger.info("version change requested for Taler DB"); }; - const myDb = await openTalerDatabase(this.idb, myVersionChange); - this._db = myDb; + try { + const myDb = await openTalerDatabase(this.idb, myVersionChange); + this._db = myDb; + } catch (e) { + logger.error("error writing to database during initialization"); + throw TalerError.fromDetail(TalerErrorCode.WALLET_DB_UNAVAILABLE, { + innerError: getErrorDetailFromException(e), + }); + } } async getTransactionState( -- cgit v1.2.3