try catch tx
This commit is contained in:
parent
3737af3a7d
commit
de0d749082
1 changed files with 28 additions and 20 deletions
|
|
@ -214,26 +214,34 @@ class StorageProcessor {
|
||||||
|
|
||||||
|
|
||||||
private async handleStartTx(operation: StartTxOperation) {
|
private async handleStartTx(operation: StartTxOperation) {
|
||||||
const res = await this.txQueue.PushToQueue({
|
try {
|
||||||
dbTx: false,
|
await this.txQueue.PushToQueue({
|
||||||
description: operation.description || "startTx",
|
dbTx: false,
|
||||||
exec: tx => {
|
description: operation.description || "startTx",
|
||||||
this.sendResponse({
|
exec: tx => {
|
||||||
success: true,
|
this.sendResponse({
|
||||||
type: 'startTx',
|
success: true,
|
||||||
data: operation.opId,
|
type: 'startTx',
|
||||||
opId: operation.opId
|
data: operation.opId,
|
||||||
});
|
opId: operation.opId
|
||||||
return new Promise((resolve, reject) => {
|
});
|
||||||
this.activeTransaction = {
|
return new Promise((resolve, reject) => {
|
||||||
txId: operation.opId,
|
this.activeTransaction = {
|
||||||
manager: tx,
|
txId: operation.opId,
|
||||||
resolve,
|
manager: tx,
|
||||||
reject
|
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<any>) {
|
private async handleEndTx(operation: EndTxOperation<any>) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue