Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Commit da7405d

Browse files
committed
ROLLBACK transaction when failing loading LOB for avatar
see Joris-van-der-Wel/node-pg-large-object#5
1 parent f3ccec3 commit da7405d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

profiles.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,13 @@ module.exports = function (options) {
622622
bufs.push(d);
623623
});
624624

625+
stream.on('error', function (err) {
626+
client.query('ROLLBACK', function () {
627+
client.end();
628+
done(err);
629+
});
630+
});
631+
625632
stream.on('end', function () {
626633
client.query('COMMIT', function () {
627634
client.end();

0 commit comments

Comments
 (0)