Avoid connection getting stuck on socket hangup (#4157)

This commit is contained in:
Igor Savin 2020-12-11 23:56:14 +02:00 committed by GitHub
parent 84cee6c445
commit 3394a02935
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,7 +38,13 @@ module.exports = class Transaction_MSSQL extends Transaction {
this._rejecter(err);
},
(err) => {
if (error) err.originalError = error;
if (error) {
try {
err.originalError = error;
} catch (_err) {
// This is to handle https://github.com/knex/knex/issues/4128
}
}
return this._rejecter(err);
}
);