OCL uses exceptions to provide application with error information. Each failed OCL call raises the exception. When it is Oracle error OCL raises OraException object. In another cases it might be CRException object.
You can process OCL exception in your own way. For example, in console application you can just print error message.
try {
...
query.open();
...
}
catch (OraException& e) {
cout << e.message();
}
See Also
OraException
OCL | Using OCL | Index