Commit f0f6ca25 authored by Steve Müller's avatar Steve Müller

wrap driver connection exceptions

parent 653c4df3
...@@ -36,7 +36,8 @@ class Driver implements \Doctrine\DBAL\Driver ...@@ -36,7 +36,8 @@ class Driver implements \Doctrine\DBAL\Driver
/** /**
* {@inheritdoc} * {@inheritdoc}
* *
* @throws SQLAnywhereException * @throws \Doctrine\DBAL\DBALException if there was a problem establishing the connection.
* @throws SQLAnywhereException if a mandatory connection parameter is missing.
*/ */
public function connect(array $params, $username = null, $password = null, array $driverOptions = array()) public function connect(array $params, $username = null, $password = null, array $driverOptions = array())
{ {
...@@ -52,6 +53,7 @@ class Driver implements \Doctrine\DBAL\Driver ...@@ -52,6 +53,7 @@ class Driver implements \Doctrine\DBAL\Driver
throw new SQLAnywhereException("Missing 'dbname' in configuration for sqlanywhere driver."); throw new SQLAnywhereException("Missing 'dbname' in configuration for sqlanywhere driver.");
} }
try {
return new SQLAnywhereConnection( return new SQLAnywhereConnection(
$this->buildDsn( $this->buildDsn(
$params['host'], $params['host'],
...@@ -64,6 +66,9 @@ class Driver implements \Doctrine\DBAL\Driver ...@@ -64,6 +66,9 @@ class Driver implements \Doctrine\DBAL\Driver
), ),
isset($params['persistent']) ? $params['persistent'] : false isset($params['persistent']) ? $params['persistent'] : false
); );
} catch (SQLAnywhereException $e) {
throw DBALException::driverException($this, $e);
}
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment