mirror of https://github.com/Fabio286/antares.git
fix(PostgreSQL): better handle connection errors, should fix #794
This commit is contained in:
parent
23c59b4d4e
commit
33bbc0e7e6
|
@ -210,6 +210,10 @@ export class PostgreSQLClient extends BaseClient {
|
||||||
if (this._params.readonly)
|
if (this._params.readonly)
|
||||||
await connection.query('SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY');
|
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;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue