Ginkgo
Generated from pipelines/1589998975 branch based on develop. Ginkgo version 1.10.0
A numerical linear algebra library targeting many-core architectures
|
The Error class is used to report exceptional behaviour in library functions. More...
#include <ginkgo/core/base/exception.hpp>
Public Member Functions | |
Error (const std::string &file, int line, const std::string &what) | |
Initializes an error. More... | |
virtual const char * | what () const noexcept override |
Returns a human-readable string with a more detailed description of the error. | |
The Error class is used to report exceptional behaviour in library functions.
Ginkgo uses C++ exception mechanism to this end, and the Error class represents a base class for all types of errors. The exact list of errors which could occur during the execution of a certain library routine is provided in the documentation of that routine, along with a short description of the situation when that error can occur. During runtime, these errors can be detected by using standard C++ try-catch blocks, and a human-readable error description can be obtained by calling the Error::what() method.
As an example, trying to compute a matrix-vector product with arguments of incompatible size will result in a DimensionMismatch error, which is demonstrated in the following program.
|
inline |
Initializes an error.
file | The name of the offending source file |
line | The source code line number where the error occurred |
what | The error message |