public function convertException(\PDOException $e)
{
$code = isset($e->errorInfo[1]) ? $e->errorInfo[1] : NULL;
if (in_array($code, [1, 2299, 38911], TRUE)) {
return Nette\Database\UniqueConstraintViolationException::from($e);
} elseif (in_array($code, [1400], TRUE)) {
return Nette\Database\NotNullConstraintViolationException::from($e);
} elseif (in_array($code, [2266, 2291, 2292], TRUE)) {
return Nette\Database\ForeignKeyConstraintViolationException::from($e);
} else {
return Nette\Database\DriverException::from($e);
}
}