Package org.codehaus.groovy.control

# Class CompilationFailedException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
groovy.lang.GroovyRuntimeException
org.codehaus.groovy.control.CompilationFailedException

All Implemented Interfaces:
  `Serializable`

Direct Known Subclasses:
  `MultipleCompilationErrorsException`

public class CompilationFailedException extends GroovyRuntimeException
Thrown when compilation fails from source errors.

See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected int`
  `phase`
  Compilation phase in which the failure occurred.
  `protected ProcessingUnit`
  `unit`
  Processing unit that reported the failure.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CompilationFailedException(int phase, ProcessingUnit unit)`
  Creates a compilation failure without an underlying cause.
  `CompilationFailedException(int phase, ProcessingUnit unit, Throwable cause)`
  Creates a compilation failure with an underlying cause.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ProcessingUnit`
  `getUnit()`
  Returns the ProcessingUnit in which the error occurred.

  ### Methods inherited from class groovy.lang.GroovyRuntimeException

  `getLocationText, getMessage, getMessageWithoutLocationText, getModule, getNode, setModule`

  ### Methods inherited from class java.lang.Throwable

  `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### phase

    protected int phase
    Compilation phase in which the failure occurred.

  - ### unit

    protected ProcessingUnit unit
    Processing unit that reported the failure.

- ## Constructor Details

  - ### CompilationFailedException

    public CompilationFailedException(int phase, ProcessingUnit unit, Throwable cause)
    Creates a compilation failure with an underlying cause.
    Parameters:
      `phase` - the phase in which the failure occurred
      `unit` - the processing unit that failed
      `cause` - the underlying cause

  - ### CompilationFailedException

    public CompilationFailedException(int phase, ProcessingUnit unit)
    Creates a compilation failure without an underlying cause.
    Parameters:
      `phase` - the phase in which the failure occurred
      `unit` - the processing unit that failed

- ## Method Details

  - ### getUnit

    public ProcessingUnit getUnit()
    Returns the ProcessingUnit in which the error occurred.