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


PHP Exception::getContext方法代码示例

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


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

示例1: makeExceptionContent

 /**
  * @param \Exception $exception
  *
  * @return array
  */
 protected static function makeExceptionContent(\Exception $exception)
 {
     $code = $exception->getCode() ?: ServiceResponseInterface::HTTP_INTERNAL_SERVER_ERROR;
     $context = $exception instanceof DfException ? $exception->getContext() : null;
     $errorInfo['context'] = $context;
     $errorInfo['message'] = htmlentities($exception->getMessage());
     $errorInfo['code'] = $code;
     if ("local" === env("APP_ENV")) {
         $trace = $exception->getTraceAsString();
         $trace = str_replace(["\n", "#"], ["", "<br>"], $trace);
         $traceArray = explode("<br>", $trace);
         $cleanTrace = [];
         foreach ($traceArray as $k => $v) {
             if (!empty($v)) {
                 $cleanTrace[] = $v;
             }
         }
         $errorInfo['trace'] = $cleanTrace;
     }
     $result = ['error' => $errorInfo];
     return $result;
 }
开发者ID:pkdevboxy,项目名称:df-core,代码行数:27,代码来源:ResponseFactory.php

示例2: handleException

 public function handleException(\Exception $exception, array $error = null)
 {
     $level = error_reporting();
     if ($this->loggedErrors & E_ERROR & ($level | $this->screamedErrors)) {
         $e = array('type' => E_ERROR, 'file' => $exception->getFile(), 'line' => $exception->getLine(), 'level' => $level, 'stack' => $exception->getTrace());
         if ($exception instanceof FatalErrorException) {
             $message = 'Fatal ' . $exception->getMessage();
         } elseif ($exception instanceof \ErrorException) {
             $message = 'Uncaught ' . $exception->getMessage();
             if ($exception instanceof ContextErrorException) {
                 $e['context'] = $exception->getContext();
             }
         } else {
             $message = 'Uncaught Exception: ' . $exception->getMessage();
         }
         if ($this->loggedErrors & $e['type']) {
             $this->loggers[$e['type']][0]->log($this->loggers[$e['type']][1], $message, $e);
         }
     }
     if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
         foreach ($this->getFatalErrorHandlers() as $handler) {
             if ($e = $handler->handleError($error, $exception)) {
                 $exception = $e;
                 break;
             }
         }
     }
     if (empty($this->exceptionHandler)) {
         throw $exception;
     }
     try {
         call_user_func($this->exceptionHandler, $exception);
     } catch (\Exception $handlerException) {
         $this->exceptionHandler = null;
         $this->handleException($handlerException);
     }
 }
开发者ID:jacobDaeHyung,项目名称:laravel_bus_reservation,代码行数:37,代码来源:compiled.php

示例3: handleReturn

 public function handleReturn(Exception $exp = null)
 {
     ${"GLOBALS"}["xhomifgcend"] = "exp";
     if (${${"GLOBALS"}["ersyqfm"]} === null) {
         if (isset($this->_objWorkflow)) {
             $this->checkUserQueue($this->_objWorkflow->getLastExecID());
             ${${"GLOBALS"}["idjaqwrixvz"]} = array("result" => "ready");
             ${${"GLOBALS"}["jbcvqlrloubk"]} = $this->_objWorkflow->getSuccessRedirection();
             if (${${"GLOBALS"}["jbcvqlrloubk"]} !== false) {
                 ${"GLOBALS"}["dqdsybzr"] = "result";
                 ${${"GLOBALS"}["dqdsybzr"]}["redirection"] = ${${"GLOBALS"}["jbcvqlrloubk"]};
                 ${${"GLOBALS"}["idjaqwrixvz"]}["redirection_target"] = $this->_objWorkflow->getSuccessRedirectionTarget();
             }
         } else {
             ${${"GLOBALS"}["idjaqwrixvz"]} = array("result" => "ready");
         }
         ${"GLOBALS"}["lburztt"] = "result";
         Workflow2::${${"GLOBALS"}["fiflovy"]} = false;
         die(json_encode(${${"GLOBALS"}["lburztt"]}));
     }
     ${"GLOBALS"}["bgnkrlnluya"] = "exp";
     if (${${"GLOBALS"}["xhomifgcend"]} instanceof \Workflow\RequestValuesException) {
         $svcmbeqp = "result";
         ${"GLOBALS"}["dvezbpy"] = "fields";
         ${${"GLOBALS"}["vyusgbxkhknd"]} = \Workflow\Queue::addEntry($exp->getTask(), $exp->getContext()->getUser(), $exp->getContext(), "static", false, 1, false);
         \Workflow\Userqueue::add("requestValue", ${${"GLOBALS"}["vyusgbxkhknd"]}, $exp->getMessage(), $this->_objWorkflow->getLastExecID(), array());
         $cvpulpbmvu = "fields";
         $nbyydxlevp = "enableError";
         ${$svcmbeqp} = array("result" => "ready");
         ${${"GLOBALS"}["dvezbpy"]} = $exp->getFields();
         foreach (${${"GLOBALS"}["vjvvxtyxgio"]} as ${${"GLOBALS"}["orcciwacpoo"]} => ${${"GLOBALS"}["bjudgmb"]}) {
             ${"GLOBALS"}["ihmbyreyp"] = "key";
             ${"GLOBALS"}["yxutovlkobh"] = "fields";
             ${"GLOBALS"}["uhzromvror"] = "value";
             ${${"GLOBALS"}["bjudgmb"]}["default"] = trim(\Workflow\VTTemplate::parse(${${"GLOBALS"}["uhzromvror"]}["default"], $this->_objWorkflow->getContext()));
             ${${"GLOBALS"}["yxutovlkobh"]}[${${"GLOBALS"}["ihmbyreyp"]}] = ${${"GLOBALS"}["bjudgmb"]};
         }
         Workflow2::${$nbyydxlevp} = false;
         die(json_encode(array("result" => "reqvalues", "request_message" => $exp->getMessage(), "fields_key" => $exp->getKey(), "execId" => $this->_objWorkflow->getLastExecID() . "##" . $exp->getTask()->getBlockId(), "fields" => ${$cvpulpbmvu})));
     }
     ${"GLOBALS"}["buukyxqqu"] = "enableError";
     Workflow2::error_handler(${${"GLOBALS"}["bgnkrlnluya"]});
     Workflow2::${${"GLOBALS"}["buukyxqqu"]} = false;
 }
开发者ID:cin-system,项目名称:cinrepo,代码行数:44,代码来源:ExecuteNew.php


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