Prepare a collaboration exception to raise to the next higher level of execution.
Syntax
void raiseException(String exceptionType, String message) void raiseException(String exceptionType, int messageNum, String parameter[,...]) void raiseException (String exceptionType, int messageNum, Object[] paramArray) void raiseException(CollaborationException exceptionObject)
Parameters
The following explanations and code examples need to be provided in the Collaboration API:
Notes
The raiseException() method prepares a collaboration exception to raise to the next higher level of execution. When the collaboration runtime environment executes the raiseException() call, it changes the collaboration's execution to the Exception state, then proceeds with the logic of the activity diagram. How the activity diagram responds to the raised exception depends on the termination node of its execution path, as follows:
If this parent diagram's next node is a decision node, the collaboration runtime environment checks for execution branches in this decision node that handle the raised exception. This parent diagram can access the raised exception through the currentException system variable.
The collaboration runtime environment associates with the unresolved flow any exception text that the raised exception contains. If this exception does not contain any exception text, the collaboration runtime environment uses the default message:
Scenario failed.
It is best to explicitly raise an exception when one occurs, rather than to just end in failure. When the code explicitly raises the exception to the collaboration runtime environment, the administrator can use the Flow Manager to view the exception text as part of the unresolved flow. For more information, see Raising the exception.
The raiseException() method has several forms:
This form is useful in raising an exception object that:
Examples
This section provides examples of each of the forms of the raiseException() method:
raiseException(ServiceCallException, "Attempt to validate Customer failed.");
23 Customer update failed for CustomerID={1} CustomerName={2}
This raiseException() call retrieves message 23 and retrieves the values of the message's two parameters (customer ID and name) from the fromCustomer variable to generate the exception message:
raiseException(OperationException, 23, fromCustomer.getString("CustomerID"), fromCustomer.getString("CustomerName"));
For example, assume the message file includes the following message text:
2000 Collaboration Message: BOName: {1} with Verb: {2} encountered an undefined error.
The following code creates a parameter array of Objects, loads values into it, and calls the raiseException() method:
Object[] myParamArray = new Object[2]; myParamArray[0] = triggeringBusObj.getType(); myParamArray[1] = triggeringBusObj.getVerb(); raiseException(AnyException, 2000, myParamArray);
raiseException(currentException);