From de0d7490825be5a502d82e5e6dcd3db3f4c1ede9 Mon Sep 17 00:00:00 2001 From: boufni95 Date: Mon, 10 Mar 2025 19:24:40 +0000 Subject: [PATCH] try catch tx --- src/services/storage/storageProcessor.ts | 48 ++++++++++++++---------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/src/services/storage/storageProcessor.ts b/src/services/storage/storageProcessor.ts index d6e53dc8..affd679f 100644 --- a/src/services/storage/storageProcessor.ts +++ b/src/services/storage/storageProcessor.ts @@ -214,26 +214,34 @@ class StorageProcessor { private async handleStartTx(operation: StartTxOperation) { - const res = await this.txQueue.PushToQueue({ - dbTx: false, - description: operation.description || "startTx", - exec: tx => { - this.sendResponse({ - success: true, - type: 'startTx', - data: operation.opId, - opId: operation.opId - }); - return new Promise((resolve, reject) => { - this.activeTransaction = { - txId: operation.opId, - manager: tx, - resolve, - reject - } - }) - } - }) + try { + await this.txQueue.PushToQueue({ + dbTx: false, + description: operation.description || "startTx", + exec: tx => { + this.sendResponse({ + success: true, + type: 'startTx', + data: operation.opId, + opId: operation.opId + }); + return new Promise((resolve, reject) => { + this.activeTransaction = { + txId: operation.opId, + manager: tx, + resolve, + reject + } + }) + } + }) + } catch (error: any) { + this.sendResponse({ + success: false, + error: error instanceof Error ? error.message : 'Unknown error occurred', + opId: operation.opId + }); + } } private async handleEndTx(operation: EndTxOperation) {