Package org.codehaus.groovy

# Class GroovyException

java.lang.Object
java.lang.Throwable
java.lang.Exception
org.codehaus.groovy.GroovyException

All Implemented Interfaces:
  `Serializable`, `GroovyExceptionInterface`

Direct Known Subclasses:
  `InvalidOptionException`, `ReadException`, `SyntaxException`

public class GroovyException extends Exception implements GroovyExceptionInterface
Base exception class for Groovy compiler errors and warnings. Implements `GroovyExceptionInterface` to track exception severity.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GroovyException()`
  Constructs a `GroovyException` with no detail message or cause.
  `GroovyException(boolean fatal)`
  Constructs a `GroovyException` with the specified fatality flag.
  `GroovyException(String message)`
  Constructs a `GroovyException` with the specified detail message.
  `GroovyException(String message, boolean fatal)`
  Constructs a `GroovyException` with the specified detail message and fatality flag.
  `GroovyException(String message, Throwable cause)`
  Constructs a `GroovyException` with the specified detail message and cause.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `isFatal()`
  Returns whether this exception is fatal.
  `void`
  `setFatal(boolean fatal)`
  Sets whether this exception is fatal.

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

  `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, 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`

- ## Constructor Details

  - ### GroovyException

    public GroovyException()
    Constructs a `GroovyException` with no detail message or cause.

  - ### GroovyException

    public GroovyException(String message)
    Constructs a `GroovyException` with the specified detail message.
    Parameters:
      `message` - the detail message describing this exception

  - ### GroovyException

    public GroovyException(String message, Throwable cause)
    Constructs a `GroovyException` with the specified detail message and cause.
    Parameters:
      `message` - the detail message describing this exception
      `cause` - the underlying cause of this exception

  - ### GroovyException

    public GroovyException(boolean fatal)
    Constructs a `GroovyException` with the specified fatality flag.
    Parameters:
      `fatal` - `true` if this exception should halt compilation; `false` otherwise

  - ### GroovyException

    public GroovyException(String message, boolean fatal)
    Constructs a `GroovyException` with the specified detail message and fatality flag.
    Parameters:
      `message` - the detail message describing this exception
      `fatal` - `true` if this exception should halt compilation; `false` otherwise

- ## Method Details

  - ### isFatal

    public boolean isFatal()
    Returns whether this exception is fatal. A fatal exception typically causes compilation to stop.
    Specified by:
      `isFatal` in interface `GroovyExceptionInterface`
    Returns:
      `true` if this exception is fatal; `false` otherwise

  - ### setFatal

    public void setFatal(boolean fatal)
    Sets whether this exception is fatal. A fatal exception typically causes compilation to stop.
    Specified by:
      `setFatal` in interface `GroovyExceptionInterface`
    Parameters:
      `fatal` - `true` to mark this exception as fatal; `false` otherwise