Top Description Fields Constructors Methods
org.codehaus.groovy.tools

public Class ErrorReporter

extends Object
Class Inheritance
Imports
groovy.lang.GroovyRuntimeException, org.codehaus.groovy.GroovyExceptionInterface, org.codehaus.groovy.control.CompilationFailedException, java.io.PrintStream, .PrintWriter

Provides services for reporting compilation errors to the user. Primary entry point is write().

Field Summary

Modifier and TypeField and Description
private Throwable
private boolean
private Object

Constructor Summary

AccessConstructor and Description
public
ErrorReporter(Throwable
the exception on which to report
e
)

Configures a new Reporter.

public
ErrorReporter(Throwable
the exception on which to report
e
,
boolean
if set, stack traces will be output for all reports
debug
)

Configures a new Reporter.

Method Summary

Modifier and TypeMethod and Description
protected void
dispatch(Throwable object, boolean child)

Runs the report once all initialization is complete.

protected void
println(String line)

Prints a line to the underlying PrintStream

protected void
protected void
report(CompilationFailedException e, boolean child)

For CompilationFailedException.

protected void
report(GroovyExceptionInterface e, boolean child)

For GroovyException.

protected void
report(Exception e, boolean child)

For Exception.

protected void
report(Throwable e, boolean child)

For everything else.

protected void
stacktrace(Throwable e, boolean always)

Displays an exception's stack trace, if debug or always.

public void
write(PrintStream stream)

Writes the error to the specified PrintStream.

public void
write(PrintWriter writer)

Writes the error to the specified PrintWriter.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

baseback to summary
private Throwable base
debugback to summary
private boolean debug
outputback to summary
private Object output

Constructor Detail

ErrorReporterback to summary
public ErrorReporter(Throwable e)

Configures a new Reporter. Default mode is not to report a stack trace unless the error was not of one of the supported types.

Parameters
e:Throwable

the exception on which to report

ErrorReporterback to summary
public ErrorReporter(Throwable e, boolean debug)

Configures a new Reporter.

Parameters
e:Throwable

the exception on which to report

debug:boolean

if set, stack traces will be output for all reports

Method Detail

dispatchback to summary
protected void dispatch(Throwable object, boolean child)

Runs the report once all initialization is complete.

printlnback to summary
protected void println(String line)

Prints a line to the underlying PrintStream

printlnback to summary
protected void println(StringBuffer line)
reportback to summary
protected void report(CompilationFailedException e, boolean child)

For CompilationFailedException.

reportback to summary
protected void report(GroovyExceptionInterface e, boolean child)

For GroovyException.

reportback to summary
protected void report(Exception e, boolean child)

For Exception.

reportback to summary
protected void report(Throwable e, boolean child)

For everything else.

stacktraceback to summary
protected void stacktrace(Throwable e, boolean always)

Displays an exception's stack trace, if debug or always.

writeback to summary
public void write(PrintStream stream)

Writes the error to the specified PrintStream.

writeback to summary
public void write(PrintWriter writer)

Writes the error to the specified PrintWriter.