@asla/yoursql 0.8.5 → 0.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/DbPoolTransaction.js +17 -10
- package/package.json +1 -1
|
@@ -36,11 +36,16 @@ class DbPoolTransaction extends DbQuery {
|
|
|
36
36
|
this.#pending = undefined;
|
|
37
37
|
reject(e);
|
|
38
38
|
const conn = this.#conn;
|
|
39
|
-
if (conn)
|
|
39
|
+
if (!conn)
|
|
40
|
+
return;
|
|
41
|
+
if (this.#errorRollback) {
|
|
42
|
+
const onFinally = () => {
|
|
43
|
+
this.#release(conn, e);
|
|
44
|
+
};
|
|
45
|
+
return conn.rollback().then(onFinally, onFinally);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
40
48
|
this.#release(conn, e);
|
|
41
|
-
if (this.#errorRollback) {
|
|
42
|
-
return conn.rollback().catch((e) => { });
|
|
43
|
-
}
|
|
44
49
|
}
|
|
45
50
|
});
|
|
46
51
|
});
|
|
@@ -80,15 +85,17 @@ class DbPoolTransaction extends DbQuery {
|
|
|
80
85
|
return res;
|
|
81
86
|
}, (e) => {
|
|
82
87
|
this.#pending = undefined;
|
|
83
|
-
this.#release(conn, e);
|
|
84
88
|
if (this.#errorRollback) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}, () => {
|
|
89
|
+
const onOk = () => {
|
|
90
|
+
this.#release(conn, e);
|
|
88
91
|
throw e;
|
|
89
|
-
}
|
|
92
|
+
};
|
|
93
|
+
return conn.rollback().then(onOk, onOk);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
this.#release(conn, e);
|
|
97
|
+
throw e;
|
|
90
98
|
}
|
|
91
|
-
throw e;
|
|
92
99
|
});
|
|
93
100
|
}
|
|
94
101
|
#query;
|