.. _error-handling: Error Handling ============== |O-MKL| error handling relies on the mechanism of C++ exceptions. Should errors occur, they are propagated at the point of a function call where they are caught using standard C++ error handling mechanisms. Exception Classification ************************ Exception classification in |O-MKL| is aligned with C++ Standard Library classification. |O-MKL| introduces a class that defines the base class in the hierarchy of |O-MKL| exception classes. All |O-MKL| routines throw exceptions inherited from this base class. In the hierarchy of |O-MKL| exceptions, ``oneapi::mkl::exception`` is the base class inherited from the ``std::exception`` class. All other |O-MKL| exception classes are derived from this base class. .. figure:: /_figures/GUID-AB72151A-7CDB-44E4-ACAF-B3AD9980FB3A-low.png :scale: 50% :align: center :alt: Hierarchy of oneMKL exceptions Hierarchy of oneMKL exceptions All |O-MKL| problem-specific exceptions are listed in the following table. .. list-table:: :header-rows: 1 * - Exception Class - Description * - ``oneapi::mkl::unsupported_device`` - Reports a problem when the routine is not supported on a specific device * - ``oneapi::mkl::host_bad_alloc`` - Reports a problem that occurred during memory allocation on the host * - ``oneapi::mkl::device_bad_alloc`` - Reports a problem that occurred during memory allocation on a specific device * - ``oneapi::mkl::unimplemented`` - Reports a problem when a specific routine has not been implemented for the specified parameters * - ``oneapi::mkl::invalid_argument`` - Reports problem when arguments to the routine were rejected * - ``oneapi::mkl::uninitialized`` - Reports problem when a handle (descriptor) has not been initialized * - ``oneapi::mkl::computation_error`` - Reports any computation error that occurred inside the |O-MKL| routine * - ``oneapi::mkl::batch_error`` - Reports errors that occurred inside batch |O-MKL| routines