Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.tools
[Java] Class ErrorReporter

    java.lang.Object
      org.codehaus.groovy.tools.ErrorReporter

    public class ErrorReporter
    extends java.lang.Object

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

Authors:
  Chris Poirier

Version:
  \$Revision\$

Constructor Summary
`ErrorReporter(java.lang.Throwable e)` Configures a new Reporter.
`ErrorReporter(java.lang.Throwable e, boolean debug)` Configures a new Reporter.

Method Summary
`protected void` | `dispatch(java.lang.Throwable object, boolean child)` Runs the report once all initialization is complete.
`protected void` | `println(java.lang.String line)` Prints a line to the underlying `PrintStream`
`protected void` | `println(java.lang.StringBuffer line)`
`protected void` | `report(CompilationFailedException e, boolean child)` For CompilationFailedException.
`protected void` | `report(GroovyExceptionInterface e, boolean child)` For GroovyException.
`protected void` | `report(java.lang.Exception e, boolean child)` For Exception.
`protected void` | `report(java.lang.Throwable e, boolean child)` For everything else.
`protected void` | `stacktrace(java.lang.Throwable e, boolean always)` Displays an exception's stack trace, if `debug` or `always`.
`void` | `write(java.io.PrintStream stream)` Writes the error to the specified `PrintStream`.
`void` | `write(java.io.PrintWriter writer)` Writes the error to the specified `PrintWriter`.

Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Constructor Detail

### ErrorReporter

    public ErrorReporter(java.lang.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` - the exception on which to report

### ErrorReporter

    public ErrorReporter(java.lang.Throwable e, boolean debug)

  Configures a new Reporter.
  Parameters:
    `e` - the exception on which to report
    `debug` - if set, stack traces will be output for all reports

Method Detail

### dispatch

    protected void dispatch(java.lang.Throwable object, boolean child)

  Runs the report once all initialization is complete.

### println

    protected void println(java.lang.String line)

  Prints a line to the underlying `PrintStream`

### println

    protected void println(java.lang.StringBuffer line)

### report

    protected void report(CompilationFailedException e, boolean child)

  For CompilationFailedException.

### report

    protected void report(GroovyExceptionInterface e, boolean child)

  For GroovyException.

### report

    protected void report(java.lang.Exception e, boolean child)

  For Exception.

### report

    protected void report(java.lang.Throwable e, boolean child)

  For everything else.

### stacktrace

    protected void stacktrace(java.lang.Throwable e, boolean always)

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

### write

    public void write(java.io.PrintStream stream)

  Writes the error to the specified `PrintStream`.

### write

    public void write(java.io.PrintWriter writer)

  Writes the error to the specified `PrintWriter`.

Groovy Documentation