14 #ifndef __PTPMGMT_ERR_H
15 #define __PTPMGMT_ERR_H
20 __PTPMGMT_NAMESPACE_BEGIN
39 void doError(
bool use_errno,
const char *file,
int line,
const char *func,
40 const std::string &msg);
41 const std::string &fetch();
42 static Error &getCur();
47 static void perror(
const char *file,
int line,
const char *func,
48 const std::string &msg)
49 { getCur().doError(
true, file, line, func, msg); }
50 static void error(
const char *file,
int line,
const char *func,
51 const std::string &msg)
52 { getCur().doError(
false, file, line, func, msg); }
53 static std::string doFormat(
const char *format, ...);
54 static void clear() { getCur().m_line = 0; }
62 static bool isError() {
return getCur().m_line > 0; }
67 static const std::string &
getError() {
return getCur().fetch(); }
72 static const std::string &
getFile() {
return getCur().m_file; }
82 static const std::string &
getFunc() {
return getCur().m_func; }
87 static int getErrno() {
return getCur().m_errno; }
93 static const std::string &
getMsg() {
return getCur().m_msg; }
102 __PTPMGMT_NAMESPACE_END
Get Last Error happend in library, C API.
Keep last error.
Definition: err.h:29
static const std::string & getError()
Definition: err.h:67
static const std::string & getErrnoMsg()
static const std::string & getMsg()
Definition: err.h:93
static bool isError()
Definition: err.h:62
static int getFileLine()
Definition: err.h:77
static const std::string & getFunc()
Definition: err.h:82
static int getErrno()
Definition: err.h:87
static const std::string & getFile()
Definition: err.h:72