fix(PostgreSQL): better handle connection errors, should fix #794

This commit is contained in:
Fabio Di Stasio 2024-04-30 18:06:11 +02:00
parent 23c59b4d4e
commit 33bbc0e7e6
1 changed files with 4 additions and 0 deletions

View File

@ -210,6 +210,10 @@ export class PostgreSQLClient extends BaseClient {
if (this._params.readonly)
await connection.query('SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY');
connection.on('error', err => { // Intercepts errors and converts to rejections
Promise.reject(err);
});
return connection;
}