geopm  3.1.1.dev296+g5916b956
GEOPM - Global Extensible Open Power Manager
Public Member Functions | List of all members
geopm::Exception Class Reference

Class for all GEOPM-specific exceptions. More...

#include <Exception.hpp>

Inheritance diagram for geopm::Exception:
Inheritance graph
[legend]
Collaboration diagram for geopm::Exception:
Collaboration graph
[legend]

Public Member Functions

 Exception ()
 Empty constructor. More...
 
 Exception (const Exception &other)
 
Exceptionoperator= (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Exception() [1/3]

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.

◆ Exception() [2/3]

geopm::Exception::Exception ( const Exception other)

◆ Exception() [3/3]

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.

Parameters
[in]whatExtension to error message returned by what() method.
[in]errError 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]fileName of source file where exception was thrown, e.g. preprocessor __FILE__.
[in]lineLine number in source file where exception was thrown, e.g. preprocessor __LINE__.

◆ ~Exception()

virtual geopm::Exception::~Exception ( )
virtualdefault

Exception destructor, virtual.

Member Function Documentation

◆ err_value()

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.

◆ operator=()

Exception & geopm::Exception::operator= ( const Exception other)

The documentation for this class was generated from the following files: