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
An exception thrown by the interpreter
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates 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.Creates a runtime exception with the supplied cause. -
Method Summary
Modifier and TypeMethodDescriptionprotected StringBuilds the source-location suffix appended to this exception's message when location data is available.Returns the message including location information when available.Returns the detail message without appended location information.Returns the related module, if any.getNode()Returns the related AST node, if any.voidsetModule(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
-
Constructor Details
-
GroovyRuntimeException
public GroovyRuntimeException()Creates an empty runtime exception. -
GroovyRuntimeException
Creates a runtime exception with the supplied message.- Parameters:
message- the detail message
-
GroovyRuntimeException
Creates a runtime exception with the supplied message and AST node.- Parameters:
message- the detail messagenode- the related AST node
-
GroovyRuntimeException
Creates a runtime exception with the supplied message and cause.- Parameters:
message- the detail messagecause- the underlying cause
-
GroovyRuntimeException
Creates a runtime exception with the supplied cause.- Parameters:
t- the underlying cause
-
-
Method Details
-
setModule
Sets the module used when reporting location information.- Parameters:
module- the related module
-
getModule
Returns the related module, if any.- Returns:
- the related module
-
getMessage
Returns the message including location information when available.- Overrides:
getMessagein classThrowable- Returns:
- the formatted message
-
getNode
Returns the related AST node, if any.- Returns:
- the related AST node
-
getMessageWithoutLocationText
Returns the detail message without appended location information.- Returns:
- the raw detail message
-
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
-