1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-11 00:24:19 +02:00

DibiException is NException descendant

This commit is contained in:
David Grudl
2007-11-18 02:29:11 +00:00
parent cbb315cbc7
commit 58ed8d34f4
4 changed files with 58 additions and 20 deletions

View File

@@ -71,7 +71,7 @@ class DibiPdoDriver extends NObject implements DibiDriverInterface
try {
$this->connection = new PDO($config['dsn'], $config['username'], $config['password'], $config['options']);
} catch (PDOException $e) {
throw $this->convertException($e);
throw new DibiDriverException($e->getMessage(), $e->getCode());
}
if (!$this->connection) {
@@ -106,7 +106,7 @@ class DibiPdoDriver extends NObject implements DibiDriverInterface
try {
$this->resultset = $this->connection->query($sql);
} catch (PDOException $e) {
throw $this->convertException($e);
throw new DibiDriverException($e->getMessage(), $e->getCode(), $sql);
}
return $this->resultset instanceof PDOStatement;
}
@@ -146,7 +146,7 @@ class DibiPdoDriver extends NObject implements DibiDriverInterface
try {
$this->connection->beginTransaction();
} catch (PDOException $e) {
throw $this->convertException($e);
throw new DibiDriverException($e->getMessage(), $e->getCode());
}
}
@@ -161,7 +161,7 @@ class DibiPdoDriver extends NObject implements DibiDriverInterface
try {
$this->connection->commit();
} catch (PDOException $e) {
throw $this->convertException($e);
throw new DibiDriverException($e->getMessage(), $e->getCode());
}
}
@@ -176,7 +176,7 @@ class DibiPdoDriver extends NObject implements DibiDriverInterface
try {
$this->connection->rollBack();
} catch (PDOException $e) {
throw $this->convertException($e);
throw new DibiDriverException($e->getMessage(), $e->getCode());
}
}
@@ -316,17 +316,4 @@ class DibiPdoDriver extends NObject implements DibiDriverInterface
function getDibiReflection()
{}
/**
* Disconnects from a database
*
* @param PDOException
* @return DibiDriverException
*/
private function convertException($e)
{
return new DibiDriverException($e->getMessage(), $e->getCode());
}
}