exceptionmessage.java
来自「Groovy动态语言 运行在JVM中的动态语言 可以方便的处理业务逻辑变化大的业」· Java 代码 · 共 73 行
JAVA
73 行
package org.codehaus.groovy.control.messages;
import java.io.PrintWriter;
import org.codehaus.groovy.control.Janitor;
import org.codehaus.groovy.control.ProcessingUnit;
/**
* A class for error messages produced by the parser system.
*
* @author <a href="mailto:cpoirier@dreaming.org">Chris Poirier</a>
*
* @version $Id: ExceptionMessage.java 4098 2006-10-10 16:09:48Z blackdrag $
*/
public class ExceptionMessage extends Message
{
protected boolean verbose = true;
private Exception cause = null; // The exception source of the message, if any
ProcessingUnit owner = null;
public ExceptionMessage( Exception cause, boolean v, ProcessingUnit owner )
{
this.verbose = v;
this.cause = cause;
this.owner = owner;
}
/**
* Returns the underlying Exception.
*/
public Exception getCause()
{
return this.cause;
}
/**
* Writes out a nicely formatted summary of the exception.
*/
public void write( PrintWriter output, Janitor janitor )
{
String description = "General error during " + owner.getPhaseDescription() + ": ";
String message = cause.getMessage();
if( message != null )
{
output.println( description + message );
}
else
{
output.println( description + cause );
}
output.println();
//if (verbose) {
cause.printStackTrace(output);
//}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?