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 {
15001500
15011501 if ( process . env . POSTGRES_CONNECTION_STRING_PATH ) {
15021502 /** @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+ }
15071511 } else {
15081512 // get the connection configuration. first from env, then from file, then default
15091513 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