Example #1
0
 /**
  * @param \Exception $e
  *
  * @return array
  */
 public static function renderException($e)
 {
     $click = function ($o, $c = TRUE) {
         return Dumper::toHtml($o, array('collapse' => $c));
     };
     $panel = array();
     if ($e instanceof Curl\FailedRequestException) {
         $panel['info'] = '<h3>Info</h3>' . $click($e->getInfo(), TRUE);
     }
     if ($e instanceof Curl\CurlException) {
         if ($e->getRequest()) {
             $panel['request'] = '<h3>Request</h3>' . $click($e->getRequest(), TRUE);
         }
         if ($e->getResponse()) {
             $panel['response'] = '<h3>Responses</h3>' . static::allResponses($e->getResponse());
         }
     }
     if (!empty($panel)) {
         return array('tab' => 'Curl', 'panel' => implode($panel));
     }
 }