exception.cpp
Go to the documentation of this file.
1 
11 #include <opc/common/exception.h>
12 
14  : LineNum(0)
15  , FileName()
16  , Code(0)
17  , Message()
18 {
19 }
20 
21 Common::Error::Error(unsigned lineNum, const char * fileName, unsigned errorCode, const char * msg)
22  : LineNum(lineNum)
23  , FileName(fileName)
24  , Code(errorCode)
25  , Message(msg)
26 {
27 }
28 
30 {
31 }
32 
33 unsigned Common::Error::GetLineNum() const
34 {
35  return LineNum;
36 }
37 
39 {
40  return FileName;
41 }
42 
43 unsigned Common::Error::GetCode() const
44 {
45  return Code;
46 }
47 
49 {
50  return Message;
51 }
52 
54 {
55  SubErrors.push_back(subError);
56  return *this;
57 }
58 
60 {
61  std::string msg = FileName;
62  msg += "(" + std::to_string(LineNum) + "):\n";
63  msg += Message;
64  std::vector<Common::Error>::const_iterator it = SubErrors.begin();
65 
66  for (; it != SubErrors.end(); ++ it)
67  {
68  msg += "\n";
69  msg += it->GetMessage();
70  }
71 
72  return msg;
73 }
74 
75 const char * Common::Error::what() const throw()
76 {
77  return Message.c_str();
78 }
std::string GetFullMessage() const
Definition: exception.cpp:59
std::string GetMessage() const
Definition: exception.cpp:48
std::string Message
Definition: exception.h:64
const char Message[]
Definition: strings.h:102
unsigned LineNum
Definition: exception.h:61
std::string FileName
Definition: exception.h:62
Error & AddError(const Error &subError)
Definition: exception.cpp:53
unsigned Code
Definition: exception.h:63
Error()
Exception class realization GNU LGPL.
Definition: exception.cpp:13
virtual ~Error()
Definition: exception.cpp:29
virtual const char * what() const
Definition: exception.cpp:75
unsigned GetCode() const
Definition: exception.cpp:43
std::vector< Error > SubErrors
Definition: exception.h:66
unsigned GetLineNum() const
Definition: exception.cpp:33
std::string GetFileName() const
Definition: exception.cpp:38


ros_opcua_impl_freeopcua
Author(s): Denis Štogl
autogenerated on Tue Jan 19 2021 03:06:04