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