Exemple #1
0
 /**
  * Run the application. If there is an exception thrown send an 500.
  *
  * @param Request $request
  */
 public function run(Request $request)
 {
     try {
         $this->handleRequest($request);
     } catch (Exception $e) {
         $logger = $this->masterFactory->getDebugFactory()->getErrorLogger();
         $logger->error($e->getMessage() . PHP_EOL . $e->getTraceAsString());
         header(sprintf('Status: %s', Response::getMessageForCode(500)));
         if (Settings::isDevMode()) {
             echo $e->getMessage() . PHP_EOL;
             echo '<pre>';
             echo $e->getTraceAsString();
             echo '</pre>';
         }
     }
 }
 /**
  * @param string $url
  * @param int    $status
  */
 protected function redirect($url, $status = 302)
 {
     $this->response->redirect($url, $status);
 }