geopm
3.1.1.dev272+gdfb40a8d
GEOPM - Global Extensible Open Power Manager
|
Class for all GEOPM-specific exceptions. More...
#include <Exception.hpp>
Public Member Functions | |
Exception () | |
Empty constructor. More... | |
Exception (const Exception &other) | |
Exception & | operator= (const Exception &other) |
Exception (const std::string &what, int err, const char *file, int line) | |
Message, error number, file and line constructor. More... | |
virtual | ~Exception ()=default |
Exception destructor, virtual. More... | |
int | err_value (void) const |
Returns the integer error code associated with the exception. More... | |
Class for all GEOPM-specific exceptions.
All exceptions explicitly thrown by the GEOPM library will be of this type. It derives from std::runtime_error and adds one method called err_value() that returns the error code associated with the exception. There are a number of different constructors.
geopm::Exception::Exception | ( | ) |
Empty constructor.
Uses errno to determine the error code. Enables an abbreviated what() result. If errno is zero then GEOPM_ERROR_RUNTIME (-1) is used for the error code.
geopm::Exception::Exception | ( | const Exception & | other | ) |
geopm::Exception::Exception | ( | const std::string & | what, |
int | err, | ||
const char * | file, | ||
int | line | ||
) |
Message, error number, file and line constructor.
User provides message, error code, file name and line number. The what() method appends the user specified message, file name and line number to the abbreviated message. This is the most verbose messaging available with the Exception class.
[in] | what | Extension to error message returned by what() method. |
[in] | err | Error code, positive values are system errors (see errno(3)), negative values are GEOPM errors. If zero is specified GEOPM_ERROR_RUNTIME (-1) is assumed. |
[in] | file | Name of source file where exception was thrown, e.g. preprocessor __FILE__ . |
[in] | line | Line number in source file where exception was thrown, e.g. preprocessor __LINE__ . |
|
virtualdefault |
Exception destructor, virtual.
int geopm::Exception::err_value | ( | void | ) | const |
Returns the integer error code associated with the exception.
Returns the non-zero error code associated with the exception. Negative error codes are GEOPM-specific and documented in the geopm_error(3) man page. Positive error codes are system errors and are documented in the system errno(3) man page. A brief description of all error codes can be obtained with the geopm_error_message(3) interface.