mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-03 22:32:40 +08:00
improved error reporting of elasticsearch ActiveFixture
This commit is contained in:
@ -101,7 +101,11 @@ class ActiveFixture extends BaseActiveFixture
|
|||||||
$options = [];
|
$options = [];
|
||||||
$id = isset($row[$idField]) ? $row[$idField] : null;
|
$id = isset($row[$idField]) ? $row[$idField] : null;
|
||||||
|
|
||||||
$response = $this->db->createCommand()->insert($this->index, $this->type, $row, $id, $options);
|
try {
|
||||||
|
$response = $this->db->createCommand()->insert($this->index, $this->type, $row, $id, $options);
|
||||||
|
} catch(\yii\db\Exception $e) {
|
||||||
|
throw new \yii\base\Exception("Failed to insert fixture data \"$alias\": " . $e->getMessage() . "\n" . print_r($e->errorInfo, true), $e->getCode(), $e);
|
||||||
|
}
|
||||||
if ($id === null) {
|
if ($id === null) {
|
||||||
$row[$idField] = $response['_id'];
|
$row[$idField] = $response['_id'];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user