mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-27 04:32:55 +00:00
exception class for c functions which set errno
This commit is contained in:
parent
9d6d26154a
commit
536f719c65
@ -24,8 +24,20 @@
|
||||
#ifndef CPPWRAP_HH
|
||||
#define CPPWRAP_HH
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
std::string strerror_r(int errnum);
|
||||
|
||||
class errno_error: public std::runtime_error {
|
||||
typedef std::runtime_error Base;
|
||||
|
||||
public:
|
||||
errno_error(const std::string &prefix, int err_ = errno)
|
||||
: Base(prefix + ": " + strerror_r(err_)), err(err_)
|
||||
{}
|
||||
|
||||
const int err;
|
||||
};
|
||||
|
||||
#endif /* CPPWRAP_HH */
|
||||
|
Loading…
Reference in New Issue
Block a user