From d97f5edf6139914c1e8e03dcaf9abcdca7b0017b Mon Sep 17 00:00:00 2001
From: Carsten Brandt <mail@cebe.cc>
Date: Fri, 9 Jan 2015 10:46:47 +0100
Subject: [PATCH] improved error reporting of elasticsearch ActiveFixture

---
 extensions/elasticsearch/ActiveFixture.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/extensions/elasticsearch/ActiveFixture.php b/extensions/elasticsearch/ActiveFixture.php
index 80e1be4..4edf59e 100644
--- a/extensions/elasticsearch/ActiveFixture.php
+++ b/extensions/elasticsearch/ActiveFixture.php
@@ -101,7 +101,11 @@ class ActiveFixture extends BaseActiveFixture
             $options = [];
             $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) {
                 $row[$idField] = $response['_id'];
             }
--
libgit2 0.27.1