当前位置: 首页>>代码示例>>PHP>>正文


PHP ExceptionHandler::createResponse方法代码示例

本文整理汇总了PHP中Symfony\Component\Debug\ExceptionHandler::createResponse方法的典型用法代码示例。如果您正苦于以下问题:PHP ExceptionHandler::createResponse方法的具体用法?PHP ExceptionHandler::createResponse怎么用?PHP ExceptionHandler::createResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\Debug\ExceptionHandler的用法示例。


在下文中一共展示了ExceptionHandler::createResponse方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display

 /**
  * Display the given exception to the user.
  *
  * @param  \Exception  $exception
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function display(Exception $exception)
 {
     if ($this->returnJson) {
         return new JsonResponse(array('error' => $exception->getMessage(), 'file' => $exception->getFile(), 'line' => $exception->getLine()), 500);
     }
     return $this->symfony->createResponse($exception);
 }
开发者ID:LuckyCyborg,项目名称:simple-mvc-framework,代码行数:13,代码来源:SymfonyDisplayer.php

示例2: showAction

 /**
  * @param Request          $request
  * @param FlattenException $exception
  * @param string           $format
  */
 public function showAction(Request $request, FlattenException $exception, $format)
 {
     $handler = new ExceptionHandler($this->pimple['debug']);
     if ($this->pimple['debug']) {
         return $handler->createResponse($exception);
     }
     $code = $exception->getStatusCode();
     $template = $this->resolve($request, $code, $format);
     if ($template) {
         $contents = $this->pimple['twig']->render($template, array('status_code' => $code, 'status_text' => isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '', 'exception' => $exception));
         return new Response($contents, $code);
     }
     return $handler->createResponse($exception);
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:19,代码来源:ExceptionController.php

示例3: createResponse

 /**
  * {@inheritdoc}
  */
 public function createResponse($exception)
 {
     if ($exception instanceof HttpException) {
         $exception = FlattenException::create($exception, $exception->getCode());
     }
     return parent::createResponse($exception);
 }
开发者ID:pagekit,项目名称:pagekit,代码行数:10,代码来源:ExceptionHandler.php

示例4: onSilexError

 public function onSilexError(GetResponseForExceptionEvent $event)
 {
     if (!$this->enabled) {
         return;
     }
     $handler = new DebugExceptionHandler($this->debug);
     $event->setResponse($handler->createResponse($event->getException()));
 }
开发者ID:ahmedibr,项目名称:project,代码行数:8,代码来源:ExceptionHandler.php

示例5: createResponseBasedOnRequest

 public function createResponseBasedOnRequest(Request $request, $exception)
 {
     return parent::createResponse($exception);
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:4,代码来源:PhraseaExceptionHandler.php

示例6: display

 /**
  * Display the given exception to the user.
  *
  * @param  \Exception  $exception
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function display(Exception $exception)
 {
     return $this->symfony->createResponse($exception);
 }
开发者ID:arifmahmudrana,项目名称:angularjs-laravel-boilerplate,代码行数:10,代码来源:SymfonyDisplayer.php

示例7: testNestedExceptions

 public function testNestedExceptions()
 {
     $handler = new ExceptionHandler(true);
     $response = $handler->createResponse(new \RuntimeException('Foo', null, new \RuntimeException('Bar')));
 }
开发者ID:yashb,项目名称:generator,代码行数:5,代码来源:ExceptionHandlerTest.php

示例8: getResponse

 /**
  * Return response from CI
  *
  * @param Request $request
  *
  * @return Response
  *
  * @throws \Exception
  */
 public function getResponse(Request $request)
 {
     if (self::$ciLoaded) {
         throw new \Exception('Can not create response for CodeIgniter controller, because another controller was already loaded.');
     }
     self::$ciLoaded = true;
     $this->unsetNoticeErrorLevel();
     $this->setCiPaths($request);
     require_once __DIR__ . '/ci_bootstrap.php';
     try {
         ob_start();
         /*
          * --------------------------------------------------------------------
          * LOAD THE BOOTSTRAP FILE
          * --------------------------------------------------------------------
          *
          * And away we go...
          *
          */
         \ci_bootstrap($this->kernel);
         $response = new Response(ob_get_clean());
     } catch (\Exception $e) {
         ob_get_clean();
         $handler = new ExceptionHandler();
         $response = $handler->createResponse($e);
     }
     return $response;
 }
开发者ID:BahuL,项目名称:NercuryCodeIgniterBundle,代码行数:37,代码来源:CiHelperService.php


注:本文中的Symfony\Component\Debug\ExceptionHandler::createResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。