本文整理汇总了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;
}
示例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);
}
}
示例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;
}