Commit 11cded9b by Alexander Makarov

Fixed Sphinx schema

parent a17e5582
......@@ -11,6 +11,7 @@ use yii\base\Object;
use yii\caching\Cache;
use Yii;
use yii\caching\GroupDependency;
use yii\db\Exception;
/**
* Schema represents the Sphinx schema information.
......@@ -60,12 +61,6 @@ class Schema extends Object
private $_builder;
/**
* @var array map of DB errors and corresponding exceptions
* If left part is found in DB error message exception class from the right part is used.
*/
public $exceptionMap = [];
/**
* @var array mapping from physical column types (keys) to abstract column types (values)
*/
public $typeMap = [
......@@ -505,4 +500,22 @@ class Schema extends Object
return $column;
}
/**
* Handles database error
*
* @param \Exception $e
* @param string $rawSql SQL that produced exception
* @throws Exception
*/
public function handleException(\Exception $e, $rawSql)
{
if ($e instanceof Exception) {
throw $e;
} else {
$message = $e->getMessage() . "\nThe SQL being executed was: $rawSql";
$errorInfo = $e instanceof \PDOException ? $e->errorInfo : null;
throw new Exception($message, $errorInfo, (int) $e->getCode(), $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