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


PHP ErrorHandler::setRequest方法代码示例

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


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

示例1: testNotFoundPageShowsCorrectCopyWhenVerboseErrorsDisabled

 public function testNotFoundPageShowsCorrectCopyWhenVerboseErrorsDisabled()
 {
     $original = Settings::getSettings();
     $settings = $original;
     $settings['errors']['verbose'] = false;
     Settings::setFromArray($settings);
     try {
         $this->request->dispatch("/notfound");
     } catch (Exception $e) {
         $handler = new ErrorHandler();
         $handler->setRequest($this->request);
         $handler->handleError($e);
         $this->assertResponseCode(404, $handler->getResponse());
         $this->assertBodyHasContents("Oops! That’s a 404", $handler->getResponse());
         $this->assertBodyHasContents("It looks like the page you’re after doesn’t exist", $handler->getResponse());
     }
     Settings::setFromArray($original);
 }
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:18,代码来源:DefaultControllerTest.php

示例2: getenv

$mode = getenv("PROJECT_MODE") !== false ? getenv("PROJECT_MODE") : "live";
//session_cache_limiter(false);
try {
    // make sure a request object is available as soon as possible
    $request = JaossRequest::getInstance();
    Settings::setMode($mode);
    include "library/boot.php";
    include "library/load_apps.php";
    if (Settings::getValue("date", "allow_from_cookie", false)) {
        $date = CookieJar::getInstance()->getCookie("test_date");
        if ($date !== null) {
            Utils::setCurrentDate($date);
        }
    }
    $request->dispatch();
    $response = $request->getResponse();
    /*
    $response->setIfNoneMatch(
        $request->getHeader('If-None-Match')
    );
    */
    $response->send();
} catch (Exception $e) {
    $handler = new ErrorHandler();
    $handler->setRequest($request);
    $handler->handleError($e);
    $response = $handler->getResponse();
    $response->send();
} catch (Exception $e) {
    exit($e->getMessage());
}
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:31,代码来源:index.php

示例3: handle

 function handle($request)
 {
     $this->request = $request;
     //
     // Set up to catch responses that drop outof the sky
     //
     ErrorHandler::setRequest($request);
     ErrorHandler::handleFatalErrors(function ($response) {
         $this->onErrorResponseFromHandlers($response);
     });
     ErrorHandler::handleScriptErrors(function ($response) {
         $this->onErrorResponseFromHandlers($response);
     });
     //		ErrorHandler::handleExceptions(function($response){ $this->onErrorResponseFromHandlers($response); });
     try {
         $this->doSetUp();
         try {
             $this->doSomething();
             $returnedValues = "good response";
             $response = new GoodResponse($this->request, $returnedVlaues);
             //
             // Here make the doSomething response into a FULL response
             //
         } catch (Exception $exception) {
             $response = ErrorResponse::fromException($exception);
             var_dump($response);
         }
     } catch (\Exception $exception) {
         $response = "outter catch block";
         //sendResponse($response);
     }
     $this->sendResponse($response);
 }
开发者ID:robertblackwell,项目名称:srmn,代码行数:33,代码来源:bootstrap.php


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