Example #1
0
 /**
  * @param \Exception|\Throwable $e
  * @return array|NULL
  */
 public static function renderException($e = NULL)
 {
     if (!$e instanceof ExceptionInterface) {
         return NULL;
     }
     $panel = NULL;
     if ($e instanceof Elastica\Exception\ResponseException) {
         $panel .= '<h3>Request</h3>';
         $panel .= Dumper::toHtml($e->getRequest());
         $panel .= '<h3>Response</h3>';
         $panel .= Dumper::toHtml($e->getResponse());
     } elseif ($e instanceof Elastica\Exception\Bulk\ResponseException) {
         $panel .= '<h3>Failures</h3>';
         $panel .= Dumper::toHtml($e->getFailures());
     }
     /*elseif ($e->getQuery() !== NULL) {
     			$panel .= '<h3>Query</h3>'
     				. '<pre class="nette-dump"><span class="php-string">'
     				. $e->getQuery()->getQuery()
     				. '</span></pre>';
     		} */
     return $panel ? array('tab' => 'ElasticSearch', 'panel' => $panel) : NULL;
 }