Package groovy.lang

# Class GroovyRuntimeException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
groovy.lang.GroovyRuntimeException

All Implemented Interfaces:
  `Serializable`

Direct Known Subclasses:
  `CacheAccessControlException`, `CompilationFailedException`, `CsvRuntimeException`, `IncorrectClosureArgumentsException`, `InvokerInvocationException`, `JavaShellCompilationException`, `MarkdownRuntimeException`, `MethodSelectionException`, `MissingClassException`, `MissingFieldException`, `MissingMethodException`, `MissingPropertyException`, `RuntimeParserException`, `SpreadListEvaluatingException`, `SpreadMapEvaluatingException`, `TomlRuntimeException`, `TooManyValuesException`, `XmlRuntimeException`, `YamlRuntimeException`

public class GroovyRuntimeException extends RuntimeException
An exception thrown by the interpreter

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GroovyRuntimeException()`
  Creates an empty runtime exception.
  `GroovyRuntimeException(String message)`
  Creates a runtime exception with the supplied message.
  `GroovyRuntimeException(String message, Throwable cause)`
  Creates a runtime exception with the supplied message and cause.
  `GroovyRuntimeException(String message, ASTNode node)`
  Creates a runtime exception with the supplied message and AST node.
  `GroovyRuntimeException(Throwable t)`
  Creates a runtime exception with the supplied cause.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected String`
  `getLocationText()`
  Builds the source-location suffix appended to this exception's message when location data is available.
  `String`
  `getMessage()`
  Returns the message including location information when available.
  `String`
  `getMessageWithoutLocationText()`
  Returns the detail message without appended location information.
  `ModuleNode`
  `getModule()`
  Returns the related module, if any.
  `ASTNode`
  `getNode()`
  Returns the related AST node, if any.
  `void`
  `setModule(ModuleNode module)`
  Sets the module used when reporting location information.

  ### 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`

- ## Constructor Details

  - ### GroovyRuntimeException

    public GroovyRuntimeException()
    Creates an empty runtime exception.

  - ### GroovyRuntimeException

    public GroovyRuntimeException(String message)
    Creates a runtime exception with the supplied message.
    Parameters:
      `message` - the detail message

  - ### GroovyRuntimeException

    public GroovyRuntimeException(String message, ASTNode node)
    Creates a runtime exception with the supplied message and AST node.
    Parameters:
      `message` - the detail message
      `node` - the related AST node

  - ### GroovyRuntimeException

    public GroovyRuntimeException(String message, Throwable cause)
    Creates a runtime exception with the supplied message and cause.
    Parameters:
      `message` - the detail message
      `cause` - the underlying cause

  - ### GroovyRuntimeException

    public GroovyRuntimeException(Throwable t)
    Creates a runtime exception with the supplied cause.
    Parameters:
      `t` - the underlying cause

- ## Method Details

  - ### setModule

    public void setModule(ModuleNode module)
    Sets the module used when reporting location information.
    Parameters:
      `module` - the related module

  - ### getModule

    public ModuleNode getModule()
    Returns the related module, if any.
    Returns:
      the related module

  - ### getMessage

    public String getMessage()
    Returns the message including location information when available.
    Overrides:
      `getMessage` in class `Throwable`
    Returns:
      the formatted message

  - ### getNode

    public ASTNode getNode()
    Returns the related AST node, if any.
    Returns:
      the related AST node

  - ### getMessageWithoutLocationText

    public String getMessageWithoutLocationText()
    Returns the detail message without appended location information.
    Returns:
      the raw detail message

  - ### getLocationText

    protected String getLocationText()
    Builds the source-location suffix appended to this exception's message when location data is available.
    Returns:
      the formatted location text, or an empty string if no location is known