OTX Reference  
OpenTestSystem.Otx.Core.Nodes.Node.EndNode.Throw Class Reference

Throws Exceptions More...

Inheritance diagram for OpenTestSystem.Otx.Core.Nodes.Node.EndNode.Throw:
Inheritance graph

Public Attributes

ExceptionTerm realisation
 Exception to be triggered. More...
 
- Public Attributes inherited from OpenTestSystem.Otx.Core.Nodes.Node
System.Boolean disabled
 To turn on/off a node. A deactivated node is not executed at run time. More...
 
- Public Attributes inherited from OpenTestSystem.Otx.Core.UniversalTypes.NamedAndSpecified
ExtensibleData[] extendedData
 Declares general data for NamedAndSpecified which can be extented by new general data defined in new OTX extensions using the standardised extension mechanism. For example it can be used to specify specification relevant content in a better structured way. More...
 
OtxId id
 Unique identifier of an element More...
 
MetaData metaData
 Additional tool-specific data More...
 
OtxName name
 Name of an element More...
 
NamedAndSpecifiedSpecification[] specification
 Descriptive specification More...
 

Detailed Description

Throws Exceptions

There are different reasons for exceptions to occur: An Exception can be thrown implicitly, e.g. by the execution of an Action node or during evaluation of a Term. For any of such Action nodes and Term types, the potentially thrown exceptions are defined. E.g. the Divide term throws an ArithmeticException under well defined conditions. Here, it is not the author who throws the exception explicitly, but it is the evaluation algorithm for Divide which is executed by the runtime system which throws the exception implicitly. The only task left for the author is to define a reaction onto the potentially expected exception by using a Catch in a Handler node. By contrast, the Throw node is a means to throw exceptions explicitly. The author can define exactly when an exception shall be thrown and he may configure the exception by providing textual information describing his user defined exception.

Note
For the Parallel node, special semantics apply when Throw is executed in parallel lanes.
Syntax
throw ExceptionTerm;
Example
namespace ExpectedExceptionsPackage1
{
public procedure main()
{
Exception exception1;
try
{
// A procedure which throws a checked exception should be inside an error handler and the error handler should handle this exeption
ProcedureWhichThrowsAnException();
}
catch (Exception exception1)
{
HMI.ConfirmDialog(GetExceptionText(exception1), GetExceptionQualifier(exception1), @MessageType:ERROR);
}
}
private procedure ProcedureWhichThrowsAnException() throws UserException
{
Exception exception1;
Integer variable;
try
{
// Division by zero will throw an ArithmeticException
variable = variable/0;
}
catch (Exception exception1)
{
// The ArithmeticException is mapped to a UserException
throw UserExceptionCreate(GetExceptionQualifier(exception1), GetExceptionText(exception1));
}
}
}
Checker rules
CheckerRule.Core_Chk017 - checked exceptions (1)
CheckerRule.Core_Chk018 - checked exceptions (2)
See also
Exceptions.Exception

Member Data Documentation

◆ realisation

ExceptionTerm OpenTestSystem.Otx.Core.Nodes.Node.EndNode.Throw.realisation

Exception to be triggered.

This can be either the value of an exception variable of any Exception type, or a newly created UserException.