fix: include original error in ROLLBACK failure

This commit is contained in:
Fedor Indutny 2025-08-07 10:32:09 -07:00 committed by GitHub
parent 26e1566203
commit b788cec79b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -555,7 +555,14 @@ export default class Database {
commit.run();
return result;
} catch (error) {
rollback.run();
try {
rollback.run();
} catch (rollbackError) {
if (rollbackError instanceof Error) {
rollbackError.cause = error;
}
throw rollbackError;
}
throw error;
} finally {
this.#transactionDepth -= 1;