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


PHP Debug::processException方法代码示例

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


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

示例1: actionDefault

	public function actionDefault($exception)
	{
		$application = Environment::getApplication();
		$application->catchExceptions = FALSE;
		if ($this->isAjax()) {
			$this->payload->error = (string)$exception;
			$this->sendPayload();

		} else {
			$this->template->robots = 'noindex,noarchive';
			if ($exception instanceof /*Nette\Application\*/BadRequestException) {

				Environment::getHttpResponse()->setCode($exception->getCode());
				switch($exception->getCode()) {
				case 403:
					$this->template->title = _('403 Permission denied');
					break;
				default:
					Environment::getHttpResponse()->setCode(404);
					$this->template->title = _('404 Not Found');
					break;
				}

			} else {
				Environment::getHttpResponse()->setCode(500);
				$this->template->title = _("Don't recognize error");

				Debug::processException($exception);
			}
		}
	}
开发者ID:norbe,项目名称:AutoUse,代码行数:31,代码来源:ErrorPresenter.php

示例2: tryFetchAll

 static function tryFetchAll($query)
 {
     try {
         $args = func_get_args();
         return call_user_func_array('dibi::fetchAll', $args);
     } catch (DibiException $e) {
         Debug::processException($e, true);
         throw new DataSourceException("Error in getting data.", 0, $e);
     }
 }
开发者ID:vrana,项目名称:mvc-exception-demo,代码行数:10,代码来源:BaseModel.php

示例3: renderDefault

 /**
  * @param  Exception
  * @return void
  */
 public function renderDefault($exception)
 {
     if ($this->isAjax()) {
         // AJAX request? Just note this error in payload.
         $this->payload->error = TRUE;
         $this->terminate();
     } elseif ($exception instanceof BadRequestException) {
         $this->setView('404');
         // load template 404.phtml
     } else {
         $this->setView('500');
         // load template 500.phtml
         Debug::processException($exception);
         // and handle error by Nette\Debug
     }
 }
开发者ID:srigi,项目名称:nette-patients,代码行数:20,代码来源:ErrorPresenter.php

示例4: __construct

 /**
  * Data grid model constructor.
  * @param  string  table name
  * @param  string  primary key name
  * @return void
  */
 public function __construct($table = NULL, $primary = NULL)
 {
     parent::__construct($table, $primary);
     if (!isset($this->primary) && isset($this->table)) {
         try {
             $dbInfo = $this->connection->getDatabaseInfo();
             $this->primary = $dbInfo->getTable($this->table)->getPrimaryKey()->getName();
         } catch (Exception $e) {
             Debug::processException($e);
             throw new InvalidArgumentException("Model must have one primary key.");
         }
     }
     if ($this->connection->profiler) {
         $this->connection->getProfiler()->setFile(Environment::expand('%logDir%') . '/sql.log');
     }
 }
开发者ID:romansklenar,项目名称:nette-datagrid,代码行数:22,代码来源:DatagridModel.php

示例5: renderDefault

 /**
  * @return void
  */
 public function renderDefault($exception)
 {
     if ($this->isAjax()) {
         $this->getPayload()->events[] = array('error', $exception->getMessage());
         $this->terminate();
     } else {
         $this->template->robots = 'noindex,noarchive';
         $httpResponse = Environment::getHttpResponse();
         if ($exception instanceof BadRequestException) {
             if (!$httpResponse->isSent()) {
                 $httpResponse->setCode($exception->getCode());
             }
             $this->template->title = '404 Not Found';
             $this->setView('404');
         } else {
             if (!$httpResponse->isSent()) {
                 $httpResponse->setCode(500);
             }
             $this->template->title = '500 Internal Server Error';
             $this->setView('500');
             Debug::processException($exception);
         }
     }
 }
开发者ID:vrana,项目名称:nette,代码行数:27,代码来源:ErrorPresenter.php

示例6: run


//.........这里部分代码省略.........
         Environment::setVariable('baseUri', $httpRequest->getUri()->getBasePath());
     }
     // autostarts session
     $session = $this->getSession();
     if (!$session->isStarted() && $session->exists()) {
         $session->start();
     }
     // check HTTP method
     if ($this->allowedMethods) {
         $method = $httpRequest->getMethod();
         if (!in_array($method, $this->allowedMethods, TRUE)) {
             $httpResponse->setCode(IHttpResponse::S501_NOT_IMPLEMENTED);
             $httpResponse->setHeader('Allow', implode(',', $this->allowedMethods));
             echo '<h1>Method ' . htmlSpecialChars($method) . ' is not implemented</h1>';
             return;
         }
     }
     // dispatching
     $request = NULL;
     $repeatedError = FALSE;
     do {
         try {
             if (count($this->requests) > self::$maxLoop) {
                 throw new ApplicationException('Too many loops detected in application life cycle.');
             }
             if (!$request) {
                 $this->onStartup($this);
                 // default router
                 $router = $this->getRouter();
                 if ($router instanceof MultiRouter && !count($router)) {
                     $router[] = new SimpleRouter(array('presenter' => 'Default', 'action' => 'default'));
                 }
                 // routing
                 $request = $router->match($httpRequest);
                 if (!$request instanceof PresenterRequest) {
                     $request = NULL;
                     throw new BadRequestException('No route for HTTP request.');
                 }
                 if (strcasecmp($request->getPresenterName(), $this->errorPresenter) === 0) {
                     throw new BadRequestException('Invalid request.');
                 }
             }
             $this->requests[] = $request;
             $this->onRequest($this, $request);
             // Instantiate presenter
             $presenter = $request->getPresenterName();
             try {
                 $class = $this->getPresenterLoader()->getPresenterClass($presenter);
                 $request->setPresenterName($presenter);
             } catch (InvalidPresenterException $e) {
                 throw new BadRequestException($e->getMessage(), 404, $e);
             }
             $request->freeze();
             // Execute presenter
             $this->presenter = new $class();
             $response = $this->presenter->run($request);
             // Send response
             if ($response instanceof ForwardingResponse) {
                 $request = $response->getRequest();
                 continue;
             } elseif ($response instanceof IPresenterResponse) {
                 $response->send();
             }
             break;
         } catch (Exception $e) {
             // fault barrier
             if ($this->catchExceptions === NULL) {
                 $this->catchExceptions = Environment::isProduction();
             }
             $this->onError($this, $e);
             if (!$this->catchExceptions) {
                 $this->onShutdown($this, $e);
                 throw $e;
             }
             if ($repeatedError) {
                 $e = new ApplicationException('An error occured while executing error-presenter', 0, $e);
             }
             if (!$httpResponse->isSent()) {
                 $httpResponse->setCode($e instanceof BadRequestException ? $e->getCode() : 500);
             }
             if (!$repeatedError && $this->errorPresenter) {
                 $repeatedError = TRUE;
                 $request = new PresenterRequest($this->errorPresenter, PresenterRequest::FORWARD, array('exception' => $e));
                 // continue
             } else {
                 // default error handler
                 echo "<meta name='robots' content='noindex'>\n\n";
                 if ($e instanceof BadRequestException) {
                     echo "<title>404 Not Found</title>\n\n<h1>Not Found</h1>\n\n<p>The requested URL was not found on this server.</p>";
                 } else {
                     Debug::processException($e, FALSE);
                     echo "<title>500 Internal Server Error</title>\n\n<h1>Server Error</h1>\n\n", "<p>The server encountered an internal error and was unable to complete your request. Please try again later.</p>";
                 }
                 echo "\n\n<hr>\n<small><i>Nette Framework</i></small>";
                 break;
             }
         }
     } while (1);
     $this->onShutdown($this, isset($e) ? $e : NULL);
 }
开发者ID:jaroslavlibal,项目名称:MDW,代码行数:101,代码来源:Application.php

示例7: run


//.........这里部分代码省略.........
     $httpResponse->setHeader('X-Powered-By', 'Nette Framework');
     if (Environment::getVariable('baseUri') === NULL) {
         Environment::setVariable('baseUri', $httpRequest->getUri()->basePath);
     }
     // check HTTP method
     $method = $httpRequest->getMethod();
     if ($this->allowedMethods) {
         if (!in_array($method, $this->allowedMethods, TRUE)) {
             $httpResponse->setCode(IHttpResponse::S501_NOT_IMPLEMENTED);
             $httpResponse->setHeader('Allow', implode(',', $this->allowedMethods));
             $method = htmlSpecialChars($method);
             die("<h1>Method {$method} is not implemented</h1>");
         }
     }
     // dispatching
     $request = NULL;
     $hasError = FALSE;
     do {
         try {
             if (count($this->requests) > self::$maxLoop) {
                 throw new ApplicationException('Too many loops detected in application life cycle.');
             }
             if (!$request) {
                 $this->onStartup($this);
                 // default router
                 $router = $this->getRouter();
                 if ($router instanceof MultiRouter && !count($router)) {
                     $router[] = new SimpleRouter(array('presenter' => 'Default', 'action' => 'default'));
                 }
                 // routing
                 $request = $router->match($httpRequest);
                 if (!$request instanceof PresenterRequest) {
                     $request = NULL;
                     throw new BadRequestException('No route for HTTP request.');
                 }
                 if (strcasecmp($request->getPresenterName(), $this->errorPresenter) === 0) {
                     throw new BadRequestException('Invalid request.');
                 }
             }
             $this->requests[] = $request;
             $this->onRequest($this, $request);
             // Instantiate presenter
             $presenter = $request->getPresenterName();
             try {
                 $class = $this->getPresenterLoader()->getPresenterClass($presenter);
                 $request->modify('name', $presenter);
             } catch (InvalidPresenterException $e) {
                 throw new BadRequestException($e->getMessage(), 404, $e);
             }
             $this->presenter = new $class($request);
             // Instantiate topmost service locator
             $this->presenter->setServiceLocator(new ServiceLocator($this->serviceLocator));
             // Execute presenter
             $this->presenter->run();
             break;
         } catch (RedirectingException $e) {
             // not error, presenter redirects to new URL
             $httpResponse->redirect($e->getUri(), $e->getCode());
             break;
         } catch (ForwardingException $e) {
             // not error, presenter forwards to new request
             $request = $e->getRequest();
         } catch (AbortException $e) {
             // not error, application is correctly terminated
             unset($e);
             break;
         } catch (Exception $e) {
             // fault barrier
             if ($this->catchExceptions === NULL) {
                 $this->catchExceptions = Environment::isProduction();
             }
             if (!$this->catchExceptions) {
                 throw $e;
             }
             $this->onError($this, $e);
             if ($hasError) {
                 $e = new ApplicationException('An error occured while executing error-presenter', 0, $e);
             } elseif ($this->errorPresenter) {
                 $hasError = TRUE;
                 $request = new PresenterRequest($this->errorPresenter, PresenterRequest::FORWARD, array('exception' => $e));
                 continue;
             }
             if ($e instanceof BadRequestException) {
                 if (!$httpResponse->isSent()) {
                     $httpResponse->setCode($e->getCode());
                 }
                 echo "<title>404 Not Found</title>\n\n<h1>Not Found</h1>\n\n<p>The requested URL was not found on this server.</p>";
                 break;
             } else {
                 if (!$httpResponse->isSent()) {
                     $httpResponse->setCode(500);
                 }
                 Debug::processException($e, FALSE);
                 echo "<title>500 Internal Server Error</title>\n\n<h1>Server Error</h1>\n\n", "<p>The server encountered an internal error and was unable to complete your request. Please try again later.</p>";
                 break;
             }
         }
     } while (1);
     $this->onShutdown($this, isset($e) ? $e : NULL);
 }
开发者ID:jakubkulhan,项目名称:shopaholic,代码行数:101,代码来源:Application.php

示例8: actionUserDelete

 public function actionUserDelete($id)
 {
     $this->access();
     $pom = $this->user->getIdentity();
     //jestliže chceme smazat sami sebe - vyhodíme hlášku a přesměrujeme
     if ($pom->id == $id) {
         $this->flashMessage("Nemůžete smazat sám sebe.");
         $this->redirect('User:default');
     } else {
         try {
             UsersModel::delUser($id);
             $this->flashMessage("Uživatel byl úspěšně smazán.");
             dibi::query('COMMIT');
         } catch (Exception $e) {
             dibi::query('ROLLBACK');
             Debug::processException($e);
             $this->flashMessage(ERROR_MESSAGE . " Error description: " . $e->getMessage(), 'error');
         }
         $this->redirect('User:default');
     }
 }
开发者ID:jaroslavlibal,项目名称:MDW,代码行数:21,代码来源:UserPresenter.php

示例9: ReplyFormProcess

 function ReplyFormProcess(Form $form)
 {
     $data = $form->getValues();
     // vezmeme data z formuláře
     $data['time'] = time();
     $data['name'] = $this->user->getidentity()->firstName . " " . $this->user->getidentity()->surname;
     if ($data['internal'] == 1) {
         $data['type'] = 2;
     } else {
         $data['type'] = 1;
     }
     try {
         TicketsModel::addReply($data);
         dibi::query('COMMIT');
         if ($data['internal'] == 0) {
             // TODO: Odeslání mailu
             $this->flashMessage("Odeslání mailu autorovi tiketu bude doprogramováno později.");
         }
     } catch (Exception $e) {
         dibi::query('ROLLBACK');
         Debug::processException($e);
         $this->flashMessage(ERROR_MESSAGE . " Error description: " . $e->getMessage(), 'error');
     }
     $this->flashMessage("Odpověď/interní poznámka byla úspěšně uložena.");
     $this->redirect('Ticket:showTicket', $data['tiket']);
 }
开发者ID:jaroslavlibal,项目名称:MDW,代码行数:26,代码来源:TicketPresenter.php


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