• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP sfException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: dispatch

 /**
  * Dispatches a request.
  *
  * This will determine which module and action to use by request parameters specified by the user.
  */
 public function dispatch()
 {
     try {
         if (sfConfig::get('sf_logging_enabled')) {
             $this->getContext()->getLogger()->info('{sfController} dispatch request');
         }
         // reinitialize filters (needed for unit and functional tests)
         sfFilter::$filterCalled = array();
         // determine our module and action
         $request = $this->getContext()->getRequest();
         $moduleName = $request->getParameter('module');
         $actionName = $request->getParameter('action');
         // make the first request
         $this->forward($moduleName, $actionName);
     } catch (sfException $e) {
         if (sfConfig::get('sf_test')) {
             throw $e;
         }
         $e->printStackTrace();
     } catch (Exception $e) {
         if (sfConfig::get('sf_test')) {
             throw $e;
         }
         try {
             // wrap non symfony exceptions
             $sfException = new sfException();
             $sfException->printStackTrace($e);
         } catch (Exception $e) {
             header('HTTP/1.0 500 Internal Server Error');
         }
     }
 }
开发者ID:taryono,项目名称:school,代码行数:37,代码来源:sfFrontWebController.class.php


示例2: dispatch

 /**
  * Dispatches a request.
  *
  * @param string A module name
  * @param string An action name
  * @param array  An associative array of parameters to be set
  */
 public function dispatch($moduleName, $actionName, $parameters = array())
 {
     try {
         // set parameters
         $this->getContext()->getRequest()->getParameterHolder()->add($parameters);
         // make the first request
         $this->forward($moduleName, $actionName);
     } catch (sfException $e) {
         $e->printStackTrace();
     } catch (Exception $e) {
         // wrap non symfony exceptions
         $sfException = new sfException();
         $sfException->printStackTrace($e);
     }
 }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:22,代码来源:sfConsoleController.class.php


示例3: dispatch

 /**
  * Dispatches a request.
  *
  * This will determine which module and action to use by request parameters specified by the user.
  */
 public function dispatch()
 {
     try {
         // reinitialize filters (needed for unit and functional tests)
         sfFilter::$filterCalled = array();
         // determine our module and action
         $request = $this->context->getRequest();
         $moduleName = $request->getParameter('module');
         $actionName = $request->getParameter('action');
         if (empty($moduleName) || empty($actionName)) {
             throw new sfError404Exception(sprintf('Empty module and/or action after parsing the URL "%s" (%s/%s).', $request->getPathInfo(), $moduleName, $actionName));
         }
         // make the first request
         $this->forward($moduleName, $actionName);
     } catch (sfError404Exception $e) {
         if (!sfConfig::get('sf_web_debug')) {
             $this->forward('dmFront', 'error404');
         } else {
             $e->printStackTrace();
         }
     } catch (sfException $e) {
         $e->printStackTrace();
     } catch (Exception $e) {
         sfException::createFromException($e)->printStackTrace();
     }
 }
开发者ID:theolymp,项目名称:diem,代码行数:31,代码来源:dmFrontWebController.php


示例4: printStackTrace

 /**
  * Forwards to the error action.
  */
 public function printStackTrace()
 {
     $exception = is_null($this->wrappedException) ? $this : $this->wrappedException;
     if (sfConfig::get('sf_debug')) {
         $response = sfContext::getInstance()->getResponse();
         if (is_null($response)) {
             $response = new sfWebResponse(sfContext::getInstance()->getEventDispatcher());
             sfContext::getInstance()->setResponse($response);
         }
         $response->setStatusCode($this->httpStatusCode);
         return sfException::printStackTrace();
         // skip sfError404Exception::printStackTrace()
     } else {
         // log all exceptions in php log
         if (!sfConfig::get('sf_test')) {
             error_log($this->getMessage());
         }
         if ($this->getMessage()) {
             sfContext::getInstance()->getRequest()->setParameter('error_message', $this->getMessage());
         }
         $module = sfConfig::get('sf_error_' . $this->httpStatusCode . '_module', sfConfig::get('sf_error_404_module', 'default'));
         $action = sfConfig::get('sf_error_' . $this->httpStatusCode . '_action', sfConfig::get('sf_error_404_action', 'error'));
         sfContext::getInstance()->getController()->forward($module, $action);
     }
 }
开发者ID:te-koyama,项目名称:openpne,代码行数:28,代码来源:opErrorHttpException.class.php


示例5: __construct

 /**
  * Class constructor.
  *
  * @param	string	the error message
  * @param	int		the error code
  */
 public function __construct($message = null, $code = 0)
 {
     // jme- removed this function. it doesnt exist
     // - in sfExceptions.php you can find
     //   - name    = get_class($exception);
     // $this->setName('sfDateTimeException');
     parent::__construct($message, $code);
 }
开发者ID:solutema,项目名称:siwapp-sf1,代码行数:14,代码来源:sfDateTimeException.class.php


示例6: dispatch

 /**
  * Dispatches a request.
  *
  * @param string $moduleName  A module name
  * @param string $actionName  An action name
  * @param array  $parameters  An associative array of parameters to be set
  */
 public function dispatch($moduleName, $actionName, $parameters = array())
 {
     try {
         // set parameters
         $this->context->getRequest()->getParameterHolder()->add($parameters);
         // make the first request
         $this->forward($moduleName, $actionName);
     } catch (sfException $e) {
         $e->printStackTrace();
     } catch (Exception $e) {
         sfException::createFromException($e)->printStackTrace();
     }
 }
开发者ID:WIZARDISHUNGRY,项目名称:symfony,代码行数:20,代码来源:sfConsoleController.class.php


示例7: initialize

 /**
  * Initializes the current sfContext instance.
  *
  * @param sfApplicationConfiguration $configuration  An sfApplicationConfiguration instance
  */
 public function initialize(sfApplicationConfiguration $configuration)
 {
     $this->configuration = $configuration;
     $this->dispatcher = $configuration->getEventDispatcher();
     try {
         $this->loadFactories();
     } catch (sfException $e) {
         $e->printStackTrace();
     } catch (Exception $e) {
         sfException::createFromException($e)->printStackTrace();
     }
     $this->dispatcher->connect('template.filter_parameters', array($this, 'filterTemplateParameters'));
     // register our shutdown function
     register_shutdown_function(array($this, 'shutdown'));
 }
开发者ID:WIZARDISHUNGRY,项目名称:symfony,代码行数:20,代码来源:sfContext.class.php


示例8: debug

  /**
   * Outputs some debug information about the current response.
   *
   * @param string $realOutput Whether to display the actual content of the response when an error occurred
   *                           or the exception message and the stack trace to ease debugging
   */
  public function debug($realOutput = false)
  {
    print $this->tester->error('Response debug');

    if (!$realOutput && null !== sfException::getLastException())
    {
      // print the exception and the stack trace instead of the "normal" output
      $this->tester->comment('WARNING');
      $this->tester->comment('An error occurred when processing this request.');
      $this->tester->comment('The real response content has been replaced with the exception message to ease debugging.');
    }

    printf("HTTP/1.X %s\n", $this->response->getStatusCode());

    foreach ($this->response->getHttpHeaders() as $name => $value)
    {
      printf("%s: %s\n", $name, $value);
    }

    foreach ($this->response->getCookies() as $cookie)
    {
      vprintf("Set-Cookie: %s=%s; %spath=%s%s%s%s\n", array(
        $cookie['name'],
        $cookie['value'],
        null === $cookie['expire'] ? '' : sprintf('expires=%s; ', date('D d-M-Y H:i:s T', $cookie['expire'])),
        $cookie['path'],
        $cookie['domain'] ? sprintf('; domain=%s', $cookie['domain']) : '',
        $cookie['secure'] ? '; secure' : '',
        $cookie['httpOnly'] ? '; HttpOnly' : '',
      ));
    }

    echo "\n";
    if (!$realOutput && null !== $exception = sfException::getLastException())
    {
      echo $exception;
    }
    else
    {
      echo $this->response->getContent();
    }
    echo "\n";
  }
开发者ID:nresni,项目名称:sfBehatPlugin,代码行数:49,代码来源:sfBehatTesterResponse.class.php


示例9: dispatch

 /**
  * Dispatches a request.
  *
  * This will determine which module and action to use by request parameters specified by the user.
  */
 public function dispatch()
 {
     try {
         if (sfConfig::get('sf_logging_enabled')) {
             $this->dispatcher->notify(new sfEvent($this, 'application.log', array('Dispatch request')));
         }
         // reinitialize filters (needed for unit and functional tests)
         sfFilter::$filterCalled = array();
         // determine our module and action
         $request = $this->context->getRequest();
         $moduleName = $request->getParameter('module');
         $actionName = $request->getParameter('action');
         if (empty($moduleName) || empty($actionName)) {
             throw new sfError404Exception(sprintf('Empty module and/or action after parsing the URL "%s" (%s/%s).', $request->getPathInfo(), $moduleName, $actionName));
         }
         // make the first request
         $this->forward($moduleName, $actionName);
     } catch (sfException $e) {
         $e->printStackTrace();
     } catch (Exception $e) {
         sfException::createFromException($e)->printStackTrace();
     }
 }
开发者ID:ajith24,项目名称:ajithworld,代码行数:28,代码来源:sfFrontWebController.class.php


示例10: preRenderCheck

 /**
  * Executes a basic pre-render check to verify all required variables exist
  * and that the template is readable.
  *
  * @throws sfRenderException If the pre-render check fails
  */
 protected function preRenderCheck()
 {
     if (null === $this->template) {
         // a template has not been set
         throw new sfRenderException('A template has not been set.');
     }
     if (!is_readable($this->directory . '/' . $this->template)) {
         // 404?
         if ('404' == $this->context->getResponse()->getStatusCode()) {
             // use default exception templates
             $this->template = sfException::getTemplatePathForError($this->context->getRequest()->getRequestFormat(), false);
             $this->directory = dirname($this->template);
             $this->template = basename($this->template);
             $this->setAttribute('code', '404');
             $this->setAttribute('text', 'Not Found');
         } else {
             throw new sfRenderException(sprintf('The template "%s" does not exist or is unreadable in "%s".', $this->template, $this->directory));
         }
     }
     // check to see if this is a decorator template
     if ($this->decorator && !is_readable($this->decoratorDirectory . '/' . $this->decoratorTemplate)) {
         throw new sfRenderException(sprintf('The decorator template "%s" does not exist or is unreadable in "%s".', $this->decoratorTemplate, $this->decoratorDirectory));
     }
 }
开发者ID:bigcalm,项目名称:urlcatcher,代码行数:30,代码来源:sfView.class.php


示例11:

<?php

include sfException::getTemplatePathForError('xml', false);
开发者ID:hunde,项目名称:bsc,代码行数:3,代码来源:error.atom.php


示例12: loadClass

 /**
  * Tries to load a class that has been specified in autoload.yml.
  *
  * @param  string  $class  A class name.
  *
  * @return boolean Returns true if the class has been loaded
  */
 public function loadClass($class)
 {
     $class = strtolower($class);
     // class already exists
     if (class_exists($class, false) || interface_exists($class, false)) {
         return true;
     }
     // we have a class path, let's include it
     if (isset($this->classes[$class])) {
         try {
             require $this->classes[$class];
         } catch (sfException $e) {
             $e->printStackTrace();
         } catch (Exception $e) {
             sfException::createFromException($e)->printStackTrace();
         }
         return true;
     }
     // see if the file exists in the current module lib directory
     if (sfContext::hasInstance() && ($module = sfContext::getInstance()->getModuleName()) && isset($this->classes[$module . '/' . $class])) {
         try {
             require $this->classes[$module . '/' . $class];
         } catch (sfException $e) {
             $e->printStackTrace();
         } catch (Exception $e) {
             sfException::createFromException($e)->printStackTrace();
         }
         return true;
     }
     return false;
 }
开发者ID:seven07ve,项目名称:vendorepuestos,代码行数:38,代码来源:sfAutoload.class.php


示例13: dispatch

 public function dispatch()
 {
     try {
         if (sfConfig::get('sf_logging_enabled')) {
             $this->getContext()->getLogger()->info('{sfController} dispatch request');
         }
         sfFilter::$filterCalled = array();
         $request = $this->getContext()->getRequest();
         $moduleName = $request->getParameter('module');
         $actionName = $request->getParameter('action');
         $this->forward($moduleName, $actionName);
     } catch (sfException $e) {
         if (sfConfig::get('sf_test')) {
             throw $e;
         }
         $e->printStackTrace();
     } catch (Exception $e) {
         if (sfConfig::get('sf_test')) {
             throw $e;
         }
         try {
             $sfException = new sfException($e->getMessage());
             $sfException->printStackTrace($e);
         } catch (Exception $e) {
             header('HTTP/1.0 500 Internal Server Error');
         }
     }
 }
开发者ID:kotow,项目名称:work,代码行数:28,代码来源:config_core_compile.yml.php


示例14: resetCurrentException

 /**
  * Resets the current exception.
  */
 public function resetCurrentException()
 {
     $this->currentException = null;
     sfException::clearLastException();
 }
开发者ID:xfifix,项目名称:symfony-1.4,代码行数:8,代码来源:sfBrowserBase.class.php


示例15: error_reporting

    error_reporting(sfConfig::get('sf_error_reporting'));
    // create bootstrap file for next time
    if (!sfConfig::get('sf_in_bootstrap') && !$sf_debug && !sfConfig::get('sf_test')) {
        $configCache->checkConfig($sf_app_config_dir_name . '/bootstrap_compile.yml');
    }
    // required core classes for the framework
    // create a temp var to avoid substitution during compilation
    if (!$sf_debug && !sfConfig::get('sf_test')) {
        $core_classes = $sf_app_config_dir_name . '/core_compile.yml';
        $configCache->import($core_classes, false);
    }
    $configCache->import($sf_app_config_dir_name . '/php.yml', false);
    $configCache->import($sf_app_config_dir_name . '/routing.yml', false);
    // include all config.php from plugins
    sfLoader::loadPluginConfig();
    // compress output
    ob_start(sfConfig::get('sf_compressed') ? 'ob_gzhandler' : '');
} catch (sfException $e) {
    $e->printStackTrace();
} catch (Exception $e) {
    if (sfConfig::get('sf_test')) {
        throw $e;
    }
    try {
        // wrap non symfony exceptions
        $sfException = new sfException();
        $sfException->printStackTrace($e);
    } catch (Exception $e) {
        header('HTTP/1.0 500 Internal Server Error');
    }
}
开发者ID:taryono,项目名称:school,代码行数:31,代码来源:symfony.php


示例16: dispatch

 public function dispatch()
 {
     try {
         sfFilter::$filterCalled = array();
         $request = $this->context->getRequest();
         $moduleName = $request->getParameter('module');
         $actionName = $request->getParameter('action');
         if (empty($moduleName) || empty($actionName)) {
             throw new sfError404Exception(sprintf('Empty module and/or action after parsing the URL "%s" (%s/%s).', $request->getPathInfo(), $moduleName, $actionName));
         }
         $this->forward($moduleName, $actionName);
     } catch (sfException $e) {
         $e->printStackTrace();
     } catch (Exception $e) {
         sfException::createFromException($e)->printStackTrace();
     }
 }
开发者ID:seven07ve,项目名称:vendorepuestos,代码行数:17,代码来源:config_core_compile.yml.php


示例17: sfException

<?php

if ('500' != $sf_error_log->getType()) {
    return;
}
?>

<?php 
$e = new sfException();
$traces = $e->getTraces($sf_error_log->getExceptionObject(), 'html');
?>

<style>
  #main { font: 11px Verdana, Arial, sans-serif; color: #333 }
  ul { list-style: decimal }
  ul li { padding-bottom: 5px; margin: 0 }
  ol { font-family: monospace; white-space: pre; list-style-position: inside; margin: 0; padding: 10px 0 }
  ol li { margin: -5px; padding: 0 }
  ol .selected { font-weight: bold; background-color: #ddd; padding: 2px 0 }
</style>

<script type="text/javascript">
function toggle(id)
{
  el = document.getElementById(id); el.style.display = el.style.display == 'none' ? 'block' : 'none';
}
</script>

<ul id="main">
  <li><?php 
echo implode("</li>\n<li>", $traces);
开发者ID:sgrove,项目名称:cothinker,代码行数:31,代码来源:_traces.php


示例18: autoload

 /**
  * Handles autoloading of classes.
  *
  * @param  string $class A class name.
  *
  * @return boolean Returns true if the class has been loaded
  */
 public function autoload($class)
 {
     $class = strtolower($class);
     // class already exists
     if (class_exists($class, false) || interface_exists($class, false)) {
         return true;
     }
     // we have a class path, let's include it
     if (isset($this->classes[$class])) {
         try {
             require $this->classes[$class];
         } catch (sfException $e) {
             $e->printStackTrace();
         } catch (Exception $e) {
             sfException::createFromException($e)->printStackTrace();
         }
         return true;
     }
     return false;
 }
开发者ID:sensorsix,项目名称:app,代码行数:27,代码来源:sfSimpleAutoload.class.php


示例19: printStackTrace

  /**
   * Forwards to the 404 action.
   */
  public function printStackTrace()
  {
    $exception = null === $this->wrappedException ? $this : $this->wrappedException;

    if (sfConfig::get('sf_debug'))
    {
      $response = sfContext::getInstance()->getResponse();
      if (null === $response)
      {
        $response = new sfWebResponse(sfContext::getInstance()->getEventDispatcher());
        sfContext::getInstance()->setResponse($response);
      }

      $response->setStatusCode(404);

      return parent::printStackTrace();
    }
    else
    {
      // log all exceptions in php log
      if (!sfConfig::get('sf_test'))
      {
        error_log($this->getMessage());
      }

      sfContext::getInstance()->getController()->forward(sfConfig::get('sf_error_404_module'), sfConfig::get('sf_error_404_action'));
    }
  }
开发者ID:nationalfield,项目名称:symfony,代码行数:31,代码来源:sfError404Exception.class.php


示例20: __construct

 /**
  * Class constructor.
  *
  * @param string The error message
  * @param int    The error code
  */
 public function __construct($message = null, $code = 0)
 {
     if (method_exists($this, 'setName')) {
         $this->setName('sfWebBrowserInvalidResponseException');
     }
     parent::__construct($message, $code);
 }
开发者ID:auphau,项目名称:joyreactor,代码行数:13,代码来源:sfWebBrowserInvalidResponseException.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP sfFilesystem类代码示例发布时间:2022-05-23
下一篇:
PHP sfEventDispatcher类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap