throwException

Versionshinweise

18.1

Code

Groovy
void ScriptUtils.throwException(String message[, Throwable cause])

Beschreibung

Erzeugt eine Exception mit der übergebenen Nachricht und dem Grund (optional).

Parameter

  • message - Die Nachricht der Exception.

  • cause - [optional] Die zu Grunde liegende Exception.

Beispiele

Groovy
if(var == null)
{
	ScriptUtils.throwException("'var' may not be null!");
}
// or
try
{
	// throws exception ... 
}
catch(Exception e)
{
	ScriptUtils.throwException("Script was terminated due to exception!", e);
}