commit 218e337a070e6b62bbf8142907c3cb8c79edc614
parent 3f2c6a741460e555c5e8faacbad0c22b2d5e4eb7
Author: Florian Dold <dold@taler.net>
Date: Sun, 19 Jul 2026 11:31:10 +0200
db: propagate the original exception when a transaction aborts
The abort reason was dropped, leaving "transaction aborted" with no cause.
Diffstat:
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/packages/taler-harness/src/integrationtests/test-peer-push.ts b/packages/taler-harness/src/integrationtests/test-peer-push.ts
@@ -147,10 +147,9 @@ export async function runPeerPushTest(t: GlobalTestState) {
}),
);
t.assertTrue(
- ex1.errorDetail.code === TalerErrorCode.WALLET_UNEXPECTED_EXCEPTION,
+ ex1.errorDetail.code ===
+ TalerErrorCode.WALLET_PEER_PUSH_PAYMENT_INSUFFICIENT_BALANCE,
);
- // FIXME propagate the error correctly
- // t.assertTrue(ex1.errorDetail.code === TalerErrorCode.WALLET_PEER_PUSH_PAYMENT_INSUFFICIENT_BALANCE);
const unknown_purse = await t.assertThrowsTalerErrorAsync(
async () =>
diff --git a/packages/taler-wallet-core/src/query.ts b/packages/taler-wallet-core/src/query.ts
@@ -655,6 +655,18 @@ function runTx<Arg, Res>(
unregisterOnCancelled();
logger.error(msg);
logger.error(`${stack.stack ?? stack}`);
+ // When the abort was caused by the transaction function throwing,
+ // reject with *that* exception rather than the wrapper. Wrapping it
+ // replaced a specific, actionable error (say "insufficient balance")
+ // with a generic "transaction aborted", so callers up the stack -- and
+ // the wallet-core API -- only ever saw an unexpected exception. The
+ // wrapper is still what internalContext records, and is still what a
+ // genuine DB-level abort (tx.error, or an abort with no exception)
+ // rejects with, since in those cases there is no better error.
+ if (transactionException !== undefined) {
+ reject(transactionException);
+ return;
+ }
reject(abortExn);
};
const resP = Promise.resolve().then(() => f(arg, tx));