powerd++  0.4.4
Classes | Enumerations | Functions | Variables
errors Namespace Reference

Common error handling types and functions. More...

Classes

struct  Exception
 Exceptions bundle an exit code, errno value and message. More...
 

Enumerations

enum  Exit : int {
  Exit::OK, Exit::ECLARG, Exit::EOUTOFRANGE, Exit::ELOAD,
  Exit::EFREQ, Exit::EMODE, Exit::EIVAL, Exit::ESAMPLES,
  Exit::ESYSCTL, Exit::ENOFREQ, Exit::ECONFLICT, Exit::EPID,
  Exit::EFORBIDDEN, Exit::EDAEMON, Exit::EWOPEN, Exit::ESIGNAL,
  Exit::ERANGEFMT, Exit::ETEMPERATURE, Exit::EEXCEPT, Exit::EFILE,
  Exit::EEXEC, Exit::EDRIVER, Exit::ESYSCTLNAME, Exit::EFORMATFIELD,
  Exit::LENGTH
}
 Exit codes. More...
 

Functions

void fail (Exit const exitcode, int const err, std::string const &msg)
 Throws an Exception instance with the given message. More...
 

Variables

const char *const ExitStr []
 Printable strings for exit codes. More...
 

Detailed Description

Common error handling types and functions.


Class Documentation

◆ errors::Exception

struct errors::Exception

Exceptions bundle an exit code, errno value and message.

Collaboration diagram for errors::Exception:
[legend]
Class Members
int err The errno value at the time of creation.
Exit exitcode The code to exit with.
string msg An error message.

Enumeration Type Documentation

◆ Exit

enum errors::Exit : int
strong

Exit codes.

Enumerator
OK 

Regular termination.

ECLARG 

Unexpected command line argument.

EOUTOFRANGE 

A user provided value is out of range.

ELOAD 

The provided value is not a valid load.

EFREQ 

The provided value is not a valid frequency.

EMODE 

The provided value is not a valid mode.

EIVAL 

The provided value is not a valid interval.

ESAMPLES 

The provided value is not a valid sample count.

ESYSCTL 

A sysctl operation failed.

ENOFREQ 

System does not support changing core frequencies.

ECONFLICT 

Another frequency daemon instance is running.

EPID 

A pidfile could not be created.

EFORBIDDEN 

Insufficient privileges to change sysctl.

EDAEMON 

Unable to detach from terminal.

EWOPEN 

Could not open file for writing.

ESIGNAL 

Failed to install signal handler.

ERANGEFMT 

A user provided range is missing the separator.

ETEMPERATURE 

The provided value is not a valid temperature.

EEXCEPT 

Untreated exception.

EFILE 

Not a valid file name.

EEXEC 

Command execution failed.

EDRIVER 

Frequency driver does not allow manual control.

ESYSCTLNAME 

User provided sysctl contains invalid characters.

EFORMATFIELD 

Formatting string contains unexpected field.

LENGTH 

Enum length.

Function Documentation

◆ fail()

void errors::fail ( Exit const  exitcode,
int const  err,
std::string const &  msg 
)
inline

Throws an Exception instance with the given message.

Parameters
exitcodeThe exit code to return on termination
errThe errno value at the time the exception was created
msgThe message to show

Variable Documentation

◆ ExitStr

const char* const errors::ExitStr[]
Initial value:
{
"OK", "ECLARG", "EOUTOFRANGE", "ELOAD", "EFREQ", "EMODE", "EIVAL",
"ESAMPLES", "ESYSCTL", "ENOFREQ", "ECONFLICT", "EPID", "EFORBIDDEN",
"EDAEMON", "EWOPEN", "ESIGNAL", "ERANGEFMT", "ETEMPERATURE",
"EEXCEPT", "EFILE", "EEXEC", "EDRIVER", "ESYSCTLNAME", "EFORMATFIELD"
}

Printable strings for exit codes.