File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -420,6 +420,7 @@ public function initialize()
420420 // Connect to the database and set the connection ID
421421 $ this ->connID = $ this ->connect ($ this ->pConnect );
422422 } catch (Throwable $ e ) {
423+ $ this ->connID = false ;
423424 $ connectionErrors [] = sprintf ('Main connection [%s]: %s ' , $ this ->DBDriver , $ e ->getMessage ());
424425 log_message ('error ' , 'Error connecting to the database: ' . $ e );
425426 }
Original file line number Diff line number Diff line change @@ -80,15 +80,19 @@ public function connect(bool $persistent = false)
8080 if ($ this ->connID !== false ) {
8181 if ($ persistent === true && pg_connection_status ($ this ->connID ) === PGSQL_CONNECTION_BAD && pg_ping ($ this ->connID ) === false
8282 ) {
83- return false ;
83+ $ error = pg_last_error ($ this ->connID );
84+
85+ throw new DatabaseException ($ error );
8486 }
8587
8688 if (! empty ($ this ->schema )) {
8789 $ this ->simpleQuery ("SET search_path TO {$ this ->schema },public " );
8890 }
8991
9092 if ($ this ->setClientEncoding ($ this ->charset ) === false ) {
91- return false ;
93+ $ error = pg_last_error ($ this ->connID );
94+
95+ throw new DatabaseException ($ error );
9296 }
9397 }
9498
You can’t perform that action at this time.
0 commit comments