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


Java QuercusException类代码示例

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


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

示例1: createExecutionException

import com.caucho.quercus.QuercusException; //导入依赖的package包/类
/**
 * Creates an execution exception with a full stack.
 * 
 * @param executable
 *        The exeuctable
 * @param x
 *        The exception
 * @return The execution exception
 */
public static ExecutionException createExecutionException( Executable executable, Exception x )
{
	ArrayList<StackFrame> stack = new ArrayList<StackFrame>();
	Throwable cause = x.getCause();
	String message = cause != null && cause.getMessage() != null ? cause.getMessage() : x.getMessage();

	if( cause instanceof ExecutionException )
		// Add the cause's stack to ours
		stack.addAll( ( (ExecutionException) cause ).getStack() );
	else if( cause instanceof ParsingException )
		// Add the cause's stack to ours
		stack.addAll( ( (ParsingException) cause ).getStack() );
	else if( x instanceof QuercusException )
		message = extractExceptionStackFromMessage( message, stack );

	if( !stack.isEmpty() )
	{
		ExecutionException executionException = new ExecutionException( message, x );
		executionException.getStack().addAll( stack );
		return executionException;
	}
	else
		return new ExecutionException( executable.getDocumentName(), message, x );
}
 
开发者ID:tliron,项目名称:scripturian,代码行数:34,代码来源:QuercusAdapter.java

示例2: reportException

import com.caucho.quercus.QuercusException; //导入依赖的package包/类
/**
 * Reports an exception in the verticle.
 */
@Override
public void reportException(Logger logger, Throwable t) {
  // A Quercus language exception.
  if (t instanceof QuercusException) {
    Env env = Env.getCurrent();
    Location location = env.getLocation();

    logger.error("\nAn exception occured in a PHP verticle.");

    // TODO: This stack trace should show only PHP related called, not
    // Java calls. Currently it only shows the trace of Java code execution.
    // logger.error(env.getStackTraceAsString(t, env.getLocation()) + "\n");
    String className = location.getClassName();
    String funcName = location.getFunctionName();
    if (funcName != null && funcName != "NULL" && !funcName.startsWith("__quercus_")) {
      if (className != "NULL" && funcName != "NULL" && !funcName.startsWith("__quercus_")) {
        logger.error(String.format("%s in %s on line %d in %s::%s()", t.getMessage(), location.getFileName(),
            location.getLineNumber(), className, funcName));
      }
      else {
        logger.error(String.format("%s in %s on line %d in %s()", t.getMessage(), location.getFileName(),
            location.getLineNumber(), funcName));
      }
    }
    else {
      logger.error(String.format("%s in %s on line %d", t.getMessage(), location.getFileName(),
          location.getLineNumber()));
    }
  }
  else {
    t.printStackTrace();
  }
}
 
开发者ID:vert-x,项目名称:mod-lang-php,代码行数:37,代码来源:PhpVerticleFactory.java

示例3: reportException

import com.caucho.quercus.QuercusException; //导入依赖的package包/类
/**
 * Reports an exception in the verticle.
 */
@Override
public void reportException(Logger logger, Throwable t) {
  // A Quercus language exception.
  if (t instanceof QuercusException) {
    Env env = Env.getCurrent();
    Location location = env.getLocation();

    logger.error("\nAn exception occured in a PHP verticle.");

    // TODO: This stack trace should show only PHP related called, not
    // Java calls. Currently it only shows the trace of Java code execution.
    // logger.error(env.getStackTraceAsString(t, env.getLocation()) + "\n");

    String className = location.getClassName();
    String funcName = location.getFunctionName();
    if (funcName != null && funcName != "NULL" && !funcName.startsWith("__quercus_")) {
      if (className != "NULL" && funcName != "NULL" && !funcName.startsWith("__quercus_")) {
        logger.error(String.format("%s in %s on line %d in %s::%s()", t.getMessage(), location.getFileName(),
            location.getLineNumber(), className, funcName));
      }
      else {
        logger.error(String.format("%s in %s on line %d in %s()", t.getMessage(), location.getFileName(),
            location.getLineNumber(), funcName));
      }
    }
    else {
      logger.error(String.format("%s in %s on line %d", t.getMessage(), location.getFileName(),
          location.getLineNumber()));
    }
  }
  else {
    t.printStackTrace();
  }
}
 
开发者ID:alwinmark,项目名称:vertx-php,代码行数:38,代码来源:PhpVerticleFactory.java


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