/**
  * Redirects processment to ErrorAction
  *
  * @param \Exception $e
  * @param boolean $isAjax
  */
 public function redirectToError($e, $isAjax = false)
 {
     $error = new ErrorAction();
     $error->setIsAjax($isAjax);
     $error->setError($e);
     $error->run();
 }
 protected function handle()
 {
     parent::handle();
     $this->code = $this->trimmed('code');
     if (!$this->code || $code < 500 || $code > 599) {
         $this->code = $this->default;
     }
     $this->message = $this->trimmed('message');
     if (!$this->message) {
         $this->message = "Server Error {$this->code}";
     }
     $this->showPage();
 }
 function handle($args)
 {
     parent::handle($args);
     $this->code = $this->trimmed('code');
     if (!$this->code || $code < 400 || $code > 499) {
         $this->code = $this->default;
     }
     $this->message = $this->trimmed('message');
     if (!$this->message) {
         $this->message = "Client Error {$this->code}";
     }
     $this->showPage();
 }
Example #4
0
if (isset($route->params['action'])) {
    // take the action class directly from the route
    $action = $route->params['action'];
} else {
    // use a default action class
    $action = 'home';
}
$action_class = ucfirst($action) . 'Action';
if (!class_exists($action_class)) {
    $error = new ErrorAction($_lang);
    $error->setErrorMessage(400, 'Unkown action &lt;' . $action_class . '&gt;');
    $error->handle();
}
$actionClass = new $action_class($_lang);
try {
    if ($actionClass->prepare($route->params)) {
        $actionClass->handle();
    }
} catch (ClientException $e) {
    $error = new ErrorAction($_lang);
    $error->setErrorMessage($e->getCode(), 'ClientException:' . $e->getMessage());
    $error->handle();
} catch (ServerException $e) {
    $error = new ErrorAction($_lang);
    $error->setErrorMessage($e->getCode(), 'ServerException: ' . $e->getMessage());
    $error->handle();
} catch (Exception $e) {
    $error = new ErrorAction($_lang);
    $error->setErrorMessage(500, 'Exception: ' . $e->getMessage());
    $error->handle();
}