Example #1
0
 public function exceptionHandler($ex)
 {
     parent::exceptionHandler($ex);
     echo "error:" . $ex->getMessage() . PHP_EOL;
     if ($this->debug) {
         echo "trace:" . PHP_EOL;
         echo $ex->getTraceAsString();
     }
     echo PHP_EOL;
     exit(1);
 }
Example #2
0
 /**
  * Exception handler
  *
  * @param \Exception $ex
  */
 public function exceptionHandler($ex)
 {
     parent::exceptionHandler($ex);
     if (true === $this->debug) {
         echo "<pre>";
         print_r($ex->__toString());
         echo "</pre>";
     }
     $errcode = $ex->getMessage();
     if ($ex instanceof Exception && ($pos = strpos($errcode, ' '))) {
         $errcode = substr($errcode, 0, $pos);
     }
     if ($this->request->method == 'GET') {
         $retrycode = Conf::get('wisphp.error.retrycode', '/\\.net_/');
         $retrynum = $this->request->get('_retry', 0);
         $retrymax = Conf::get('wisphp.error.retrymax', 1);
         if ($retrycode && $retrynum < $retrymax && preg_match($retrycode, $errcode) > 0) {
             $retrynum++;
             $gets = array_merge($_GET, array('_retry' => $retrynum));
             $url = $this->request->url . '?' . http_build_query($gets);
             $this->response->setHeader('X-Rewrite-URI: ' . $url);
             $this->response->send();
             exit;
         }
     }
     $this->response->setFrHeader($errcode);
     $this->setHeader($errcode);
     if ($this->request->needErrorPage()) {
         $this->goErrorPage($errcode);
         exit;
     }
     $this->response->setException($ex);
     $this->response->send();
     exit;
 }