Go to the documentation of this file.
9 #ifndef _POWERDXX_ERRORS_HPP_
10 #define _POWERDXX_ERRORS_HPP_
17 using namespace std::literals::string_literals;
54 "OK",
"ECLARG",
"EOUTOFRANGE",
"ELOAD",
"EFREQ",
"EMODE",
"EIVAL",
55 "ESAMPLES",
"ESYSCTL",
"ENOFREQ",
"ECONFLICT",
"EPID",
"EFORBIDDEN",
56 "EDAEMON",
"EWOPEN",
"ESIGNAL",
"ERANGEFMT",
"ETEMPERATURE",
57 "EEXCEPT",
"EFILE",
"EEXEC",
"EDRIVER",
"ESYSCTLNAME",
"EFORMATFIELD"
61 "Every Exit code must have a string representation");
93 [[noreturn]]
inline void
94 fail(
Exit const exitcode,
int const err, std::string
const & msg) {
@ EIVAL
The provided value is not a valid interval.
@ EOUTOFRANGE
A user provided value is out of range.
@ ESYSCTLNAME
User provided sysctl contains invalid characters.
@ ESAMPLES
The provided value is not a valid sample count.
constexpr size_t countof(T(&)[Count])
Like sizeof(), but it returns the number of elements an array consists of instead of the number of by...
Definition: utility.hpp:32
@ ENOFREQ
System does not support changing core frequencies.
Exit exitcode
The code to exit with.
Definition: errors.hpp:70
@ EWOPEN
Could not open file for writing.
@ ELOAD
The provided value is not a valid load.
Common error handling types and functions.
Definition: errors.hpp:15
@ EDRIVER
Frequency driver does not allow manual control.
@ EFILE
Not a valid file name.
constexpr VT to_value(ET const op)
Casts an enum to its underlying value.
Definition: utility.hpp:85
Exit
Exit codes.
Definition: errors.hpp:22
@ EPID
A pidfile could not be created.
Exceptions bundle an exit code, errno value and message.
Definition: errors.hpp:66
@ ETEMPERATURE
The provided value is not a valid temperature.
@ ESIGNAL
Failed to install signal handler.
@ EFREQ
The provided value is not a valid frequency.
void fail(Exit const exitcode, int const err, std::string const &msg)
Throws an Exception instance with the given message.
Definition: errors.hpp:94
int err
The errno value at the time of creation.
Definition: errors.hpp:75
@ ESYSCTL
A sysctl operation failed.
@ ERANGEFMT
A user provided range is missing the separator.
std::string msg
An error message.
Definition: errors.hpp:80
@ EEXEC
Command execution failed.
const char *const ExitStr[]
Printable strings for exit codes.
Definition: errors.hpp:53
@ EMODE
The provided value is not a valid mode.
@ EFORBIDDEN
Insufficient privileges to change sysctl.
@ EFORMATFIELD
Formatting string contains unexpected field.
@ EDAEMON
Unable to detach from terminal.
@ ECLARG
Unexpected command line argument.
Implements generally useful functions.
@ ECONFLICT
Another frequency daemon instance is running.
@ EEXCEPT
Untreated exception.