![]() |
![]() |
![]() |
![]() |
![]() |
The operation belongs to the family of procedure-based communication operations. It is used to handle exceptions from a previously called procedure.
Related keywords:
port_reference.catch [ (signature_reference, template_instance ) ] [ from address_reference ] [ -> assignment_part ]; |
port_reference points out the port where the exception is raised.
the keywords any port may be used to indicate that exceptions will be accepted at any port (see the example 4).
The catch keyword introduces the exception capture.
signature_reference points out the signature where the exception is defined
template_instance may be one of the following (when omitted, any valid exception will be caught):
TITAN specific restriction compared to the standard:
|
The optional from keyword is used when a port is connected to several entities and restriction to one communication partner is required.
address_reference is one of the following:
assignment_part is one or both of the following:
Example 1: in-line signature template
signature S_MyProcedure (inout integer pl_MyPar91) exception (integer, float);
MujPort_PCO.catch(S_MyProcedure, integer:14 .. 143) from system;
The signature S_MyProcedure is defined in the first line. It has one parameter (pl_MyPar91, pl_MyPar2 and pl_MyPar3). In the second line, an exception is caught at the port MujPort_PCO. The port is connected to several components, but communication is restricted to one component, here to the test system interface. Exceptions with the integer code between 14 and 143 are caught.
Example 2: signature template and address redirect
template IntegerFloatRecord tr_ExTemplate := {
field1 := 1 .. 6,
field2 := 0.0 .. infinity
}
MujPort_PCO.catch (S_MyProcedure, tr_ExTemplate) -> sender v_address;
The parameterized template (tr_ExTemplate) catches exceptions where the integer parameter lies between one and six, and the floating point value parameter greater than zero. The address of the component raising the exception is stored in the variable v_address.
Example 3: modified signature template and value redirect
MujPort_PCO.catch (modifies tr_ExTemplate := {field1 := 6}) -> value v_Exc;
The template defined in example 2 is modified. The response is now accepted when the integer parameter equals six. The returned exception value is stored in the variable v_Exc.
Example 4: receive on any port
any port.catch (tr_ExTemplate);
The exception matching the template tr_ExTemplate will be accepted on any port.
Example 5: Accepting any exception
MujPort_PCO.catch;
Removes the top exception from MujPort_PCO.
Example 6: Catching a timeout
MujPort_PCO.catch(timeout);
The exception caused by the timeout at the port MujPort_PCO is caught.
BNF definition of catch