Raises an exception.
Syntax
void raiseException(String exceptionType, String message)
void raiseException(String exceptionType, int messageNum,
String parameter[,...])
void raiseException(RunTimeEntityException exception)
Parameters
- exceptionType
- One of the following IBM WebSphere InterChange Server
Express-defined constants:
- AnyException
- Any type of exception
-
AttributeException
- Attribute access problem. For example, the collaboration called
getDouble() on a String attribute or called
getString() on a nonexistent attribute.
- JavaException
- Problem with Java code that is not part of the IBM WebSphere
InterChange Server Express API.
-
ObjectException
- Business object passed to a method was invalid or a null object
was accessed.
-
OperationException
- Service call was improperly set up and could not be sent.
-
ServiceCallException
- Service call failed. For example, a connector or application is
unavailable.
-
SystemException
- Any internal error within the IBM WebSphere InterChange Server
Express system.
- message
- A text string that embeds the exception message in the method
call.
- messageNum
- A reference to a numbered message in the map message file.
- parameters
- A value for the parameter in the message itself. There can be
up to five parameters in the method call.
- exception
- The name of an exception object variable.
Return values
None.
Notes
The raiseException() method has three forms:
- The first form of the method creates a new exception, passing
an exception type and a string. Use it to embed a message into the
method call itself.
- The second form creates a new exception, passing an exception
type and a reference to a message in the map message file. The
method call can contain up to five parameters, separated with
commas.
- The third form raises an exception object that the map has
previously handled. For example, a transformation step might get an
exception, assign it to a variable, and do some other work.
Finally, the transformation step raises the exception.
- Note:
- All forms of the method that take a messageNum parameter
require the use of a message file that is indexed by message
number. For information on how to set up a message text file, refer
to Appendix A,
"Message files".
Examples
The following example uses the first form of the method to raise
an exception of ServiceCallException type. The text is
embedded in the method call.
raiseException(ServiceCallException,
"Attempt to validate Customer failed.");
The next example raises an exception of
ServiceCallException type. The message in the message file
is as follows:
23
Customer update failed for CustomerID={1} CustomerName={2}
The raiseException() method invokes the message,
retrieves the values of the message parameters from the
fromCustomer variable, and passes them to the
raiseException() call.
raiseException(ServiceCallException, 23,
fromCustomer.getString("CustomerID"),
fromCustomer.getString("CustomerName"));
The final example raises a previously handled exception. The
system-defined variable currentException is an exception
object that contains the exception.
raiseException(currentException);
