Developer Guide for Intel® Data Analytics Acceleration Library 2016 Update 4

Handling Errors

Intel DAAL provides classes and methods to handle exceptions or errors that can occur during library operation.

In Intel DAAL C++ interfaces, the base class for error handling is Error. This class contains an error message and details of the issue. For example, an Error object can store the number of the row in the NumericTable that caused the issue or a message that an SQL database generated to describe the reasons of an unsuccessful query. A single Error object can store the error description and an arbitrary number of details of various types: integer or double values or strings.

Most of Intel DAAL classes, such as Algorithm classes, contain an ErrorCollection class, which handles errors for the class. In addition to the functionality of the Error class, ErrorCollection creates an integrated error description and throws run-time exceptions. Some of the Intel DAAL classes, such as NumericTable, contain a KernelErrorCollection class. This class functions similarly to ErrorCollection, but does not throw run-time exceptions.

By default, when you add an error to the ErrorCollection object, ErrorCollection throws a run-time exception. To prevent throwing any exceptions, you can set the DAAL_NOTHROW_EXCEPTIONS flag. If the flag is set, use isEmpty() and getErrors() methods of the ErrorCollection or KernelErrorCollection class to check whether any errors occur. To get a concatenated error description, call the getDescription() method of the KernelErrorCollection or ErrorCollection class.

Intel DAAL Java* interfaces handle errors by throwing Java exceptions.

Examples

C++:

Java*: ErrorHandling.java