Package groovy.lang

Class 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:
  • 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