org.codehaus.groovy.tools
Class ErrorReporter

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

author:
Chris Poirier
version:
$Revision: 6778 $

Field Summary
 Throwable base
           
 boolean debug
           
 Object output
           
 
Constructor Summary
ErrorReporter(Throwable e)
            Configures a new Reporter.
ErrorReporter(Throwable e, boolean debug)
            Configures a new Reporter.
 
Method Summary
void dispatch(Throwable object, boolean child)
           Runs the report once all initialization is complete.
void println(String line)
           Prints a line to the underlying PrintStream
void println(StringBuffer line)
          
void report(CompilationFailedException e, boolean child)
           For CompilationFailedException.
void report(GroovyExceptionInterface e, boolean child)
           For GroovyException.
void report(Exception e, boolean child)
           For Exception.
void report(Throwable e, boolean child)
           For everything else.
void stacktrace(Throwable e, boolean always)
           Displays an exception's stack trace, if debug or always.
void write(PrintStream stream)
           Writes the error to the specified PrintStream.
void write(PrintWriter writer)
           Writes the error to the specified PrintWriter.
 

Constructor Detail

ErrorReporter

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.
param:
e the exception on which to report


ErrorReporter

public ErrorReporter(Throwable e, boolean debug)
Configures a new Reporter.
param:
e the exception on which to report
param:
debug if set, stack traces will be output for all reports


Method Detail

dispatch

void dispatch(Throwable object, boolean child)
Runs the report once all initialization is complete.


println

void println(String line)
Prints a line to the underlying PrintStream


println

void println(StringBuffer line)


report

void report(CompilationFailedException e, boolean child)
For CompilationFailedException.


report

void report(GroovyExceptionInterface e, boolean child)
For GroovyException.


report

void report(Exception e, boolean child)
For Exception.


report

void report(Throwable e, boolean child)
For everything else.


stacktrace

void stacktrace(Throwable e, boolean always)
Displays an exception's stack trace, if debug or always.


write

public void write(PrintStream stream)
Writes the error to the specified PrintStream.


write

public void write(PrintWriter writer)
Writes the error to the specified PrintWriter.