Commit 7764086c by Alexander Makarov

IntegrityException should be thrown for relational DBs only

parent d1ec2a02
......@@ -781,12 +781,15 @@ class Command extends \yii\base\Component
throw $e;
} else {
$exceptionClass = '\yii\db\Exception';
$errorMap = $this->db->getSchema()->errorMap;
foreach ($errorMap as $error => $class) {
$schema = $this->db->getSchema();
if ($schema instanceof Schema) {
$exceptionMap = $schema->exceptionMap;
foreach ($exceptionMap as $error => $class) {
if (strpos($e->getMessage(), $error) !== false) {
$exceptionClass = $class;
}
}
}
$message = $e->getMessage() . "\nThe SQL being executed was: $rawSql";
$errorInfo = $e instanceof \PDOException ? $e->errorInfo : null;
......
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