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
throw $e;
} else {
$exceptionClass = '\yii\db\Exception';
$errorMap = $this->db->getSchema()->errorMap;
foreach ($errorMap as $error => $class) {
if (strpos($e->getMessage(), $error) !== false) {
$exceptionClass = $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;
}
}
}
......
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