Skip to content

Commit

Permalink
check error cause sanity
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtificialOwl authored and backportbot[bot] committed May 15, 2021
1 parent 241b323 commit 6714d5a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/Platform/ElasticSearchPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
namespace OCA\FullTextSearch_Elasticsearch\Platform;


use daita\MySmallPhpTools\Traits\TArrayTools;
use daita\MySmallPhpTools\Traits\TPathTools;
use Elasticsearch\Client;
use Elasticsearch\ClientBuilder;
Expand Down Expand Up @@ -59,6 +60,7 @@ class ElasticSearchPlatform implements IFullTextSearchPlatform {


use TPathTools;
use TArrayTools;


/** @var ConfigService */
Expand Down Expand Up @@ -307,8 +309,9 @@ private function parseIndexErrorException(Exception $e): string {
return $e->getMessage();
}

if (array_key_exists('reason', $arr['error']['root_cause'][0])) {
return $arr['error']['root_cause'][0]['reason'];
$cause = $this->getArray('error.root_cause', $arr);
if (!empty($cause)) {
return $this->get('reason', $cause[0]);
}

return $e->getMessage();
Expand Down

0 comments on commit 6714d5a

Please sign in to comment.