Script abort

Syntax

	throw($message)

throw($message, $detail)

throw($message, $detail, $value)

Description

Generates an error message on the user interface. The script is aborted.

Parameters

name Type Type Description Mandatory Default
message Character string/internationalized text The main message of the message. yes
detail Character string/internationalized text Details about message. no No details.
value Any value An additional value that is passed with the exception. Can be caught by the catch function in try(). no No value.

Examples

Message with character strings

	throw('Error', 'Invalid username');

Output:

Message with internationalized texts)

{
   message = #("Fehler"@de, "Error"@en);
   details = #("Ungültiger Username"@de, "Invalid username"@en);
   
   throw($message, $details);
}

Output:

German:

English:

Script abort by message

{   
   userName = "test";
   if($userName.length() < 8, throw("Name to short!", "Choose a longer username"), info("Good Name!"));
   a = new(`my.module:MyClass`);
   $a.set(`my.module:MyClass#userName`, $userName);
}

Output:

The script is canceled and no new object with the user name is created.

Example with value parameter

{
   userId = 1234;
   if($userId < 10000, 
      throw("Ungültige Benutzer-ID", "ID muss größer als 10000 sein", $userId), 
      info("Gültige Benutzer-ID: " + $userId)
   );
}

Output:

The script is aborted and the user ID is passed as a value with the exception. This value can be caught by a try()-catch function.