コード例 #1
0
ファイル: Application.php プロジェクト: alikon/jstats-server
 /**
  * Method to run the application routines.
  *
  * @return  void
  *
  * @since   1.0
  */
 public function doExecute()
 {
     try {
         $controller = $this->router->getController($this->get('uri.route'));
         $controller->execute();
     } catch (\Exception $e) {
         $this->setErrorHeader($e);
         $data = ['error' => true, 'message' => $e->getMessage()];
         $this->setBody(json_encode($data));
     }
 }
コード例 #2
0
 /**
  * Execute the Application
  *
  * @return void
  */
 public function doExecute()
 {
     try {
         $controller = $this->router->getController($this->get("uri.route"));
         $this->setBody($controller->execute());
     } catch (\Exception $e) {
         if ($e->getCode() === 404) {
             http_response_code(404);
         }
         $this->setBody($e->getMessage());
     }
 }
コード例 #3
0
 /**
  * Method to run the application routines.
  *
  * @return  void
  *
  * @since   1.0
  */
 public function doExecute()
 {
     try {
         $controller = $this->router->getController($this->get('uri.route'));
         $controller->execute();
     } catch (\Exception $e) {
         // Log the error for reference
         $this->getLogger()->error($e->getMessage(), ['trace' => $e->getTraceAsString()]);
         $this->setErrorHeader($e);
         $data = ['error' => true, 'message' => $e->getMessage()];
         $this->setBody(json_encode($data));
     }
 }