/**
  * [call description]
  *
  * @return [type] [description]
  */
 public function call()
 {
     $app = $this->app;
     $this->init();
     if ($this->hasHandler()) {
         // why should prevent session?
         // $this->app->config('session.preventSession', true);
         $app->error(array($this, 'error'));
         $app->notFound(array($this, 'notFound'));
         $this->next->call();
         if ($this->app->notification) {
             $errors = $this->app->notification->query(array('level' => 'error'));
             if (!empty($errors)) {
                 $error = $errors[0];
                 if (isset($error['exception'])) {
                     throw $error['exception'];
                 } else {
                     $ex = new BonoException($error['message'], $error['code'], $error['exception']);
                     $ex->setStatus($error['status']);
                     throw $ex;
                 }
             }
         }
         $this->render();
     } else {
         $this->next->call();
     }
 }
 /**
  * Class constructor
  *
  * @param string     $message
  * @param integer    $code
  * @param \Exception $previousException
  */
 public function __construct($message = '', $code = 0, $previousException = null)
 {
     $this->formatMessage = $message;
     $this->setStatus(400);
     parent::__construct($message, $code, $previousException);
 }