File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -1500,10 +1500,14 @@ class PostgresClient extends EventEmitter {
1500
1500
1501
1501
if ( process . env . POSTGRES_CONNECTION_STRING_PATH ) {
1502
1502
/** @type {import('pg').PoolConfig } */
1503
- this . new_pool_params = {
1504
- connectionString : fs . readFileSync ( process . env . POSTGRES_CONNECTION_STRING_PATH , "utf8" ) ,
1505
- ...params ,
1506
- } ;
1503
+ try {
1504
+ this . new_pool_params = {
1505
+ connectionString : fs . readFileSync ( process . env . POSTGRES_CONNECTION_STRING_PATH , "utf8" ) ,
1506
+ ...params ,
1507
+ } ;
1508
+ } catch ( err ) {
1509
+ throw new Error ( `Failed to read connection string file '${ process . env . POSTGRES_CONNECTION_STRING_PATH } ': ${ err . message } ` ) ;
1510
+ }
1507
1511
} else {
1508
1512
// get the connection configuration. first from env, then from file, then default
1509
1513
const host = process . env . POSTGRES_HOST || fs_utils . try_read_file_sync ( process . env . POSTGRES_HOST_PATH ) || '127.0.0.1' ;
You can’t perform that action at this time.
0 commit comments