Exception handling (throwException)

Activate this for any CICS® condition, such as QIDERR, as follows.

IccTempStore temp("TEMP1234");
temp.setActionOnCondition(IccResource::throwException,
IccCondition::QIDERR);
Exception handling is by means of the C++ exception handling model using try , throw , and catch . For example:
try
{
buf = temp.readNextItem();
⋮
}
catch (IccException& exception)
{
//Exception handling code
⋮
}

An exception is thrown if any of the methods inside the try block raise the QIDERR condition for object 'temp'. When an exception is thrown, C++ unwinds the stack and resumes execution at an appropriate catch block – it is not possible to resume within the try block. For a fuller example, see sample ICC$EXC3.

Note: Exceptions can be thrown from the Foundation Classes for many reasons other than this example – see C++ Exceptions and the Foundation Classes for more details.