diff --git a/src/Database/Connection.php b/src/Database/Connection.php index 3dc67d84722..de1b0289e51 100644 --- a/src/Database/Connection.php +++ b/src/Database/Connection.php @@ -213,15 +213,13 @@ public function driver($driver = null, $config = []) /** * Connects to the configured database. * - * @throws \Cake\Database\Exception\MissingConnectionException if credentials are invalid - * @return bool true on success or false if already connected. + * @throws \Cake\Database\Exception\MissingConnectionException if credentials are invalid. + * @return bool true, if the connection was already established or the attempt was successful. */ public function connect() { try { - $this->_driver->connect(); - - return true; + return $this->_driver->connect(); } catch (\Exception $e) { throw new MissingConnectionException(['reason' => $e->getMessage()]); }