Commit 7764086c by Alexander Makarov

IntegrityException should be thrown for relational DBs only

parent d1ec2a02
...@@ -781,10 +781,13 @@ class Command extends \yii\base\Component ...@@ -781,10 +781,13 @@ class Command extends \yii\base\Component
throw $e; throw $e;
} else { } else {
$exceptionClass = '\yii\db\Exception'; $exceptionClass = '\yii\db\Exception';
$errorMap = $this->db->getSchema()->errorMap; $schema = $this->db->getSchema();
foreach ($errorMap as $error => $class) { if ($schema instanceof Schema) {
if (strpos($e->getMessage(), $error) !== false) { $exceptionMap = $schema->exceptionMap;
$exceptionClass = $class; foreach ($exceptionMap as $error => $class) {
if (strpos($e->getMessage(), $error) !== false) {
$exceptionClass = $class;
}
} }
} }
......
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