9 #include <boost/system/error_code.hpp> 10 #include <boost/version.hpp> 14 #include "gtest/gtest.h" 17 #define XSTR(x) STR(x) 20 #if BOOST_VERSION < 107000 21 #define BOOST_IO_CONTEXT boost::asio::io_context 22 #define BOOST_GET_CONTEXT(x) x->get_executor().context() 23 #define BOOST_GET_EXECUTOR(x) boost::ref(x) 25 #define BOOST_IO_CONTEXT const boost::asio::any_io_executor 26 #define BOOST_GET_CONTEXT(x) x->get_executor() 27 #define BOOST_GET_EXECUTOR(x) x.get_executor() 48 DPY_NOT_PERMITTED = 11,
50 DPY_BAD_PARAMETER = 13,
54 DPY_NOT_IMPLEMENTED = 17,
56 DPY_COULD_NOT_OBTAIN_VALUE = 19,
57 DPY_EMPTY_MESSAGE = 20,
59 DPY_COMMAND_ERROR = 22,
60 DPY_INVALID_VALUE = 23,
62 DPY_CONFIG_ERROR = 25,
64 DPY_INVALID_CHECKSUM = 27,
65 DPY_REQUEST_PROCESSED = 28,
66 DPY_REQUEST_DEFERRED = 29,
69 DPY_FILE_COULD_NOT_BE_OPENED = 30,
70 DPY_FILE_DOES_NOT_EXIST = 31,
71 DPY_FILE_CORRUPTED = 32,
72 DPY_FILE_JSON_PARSE_ERROR = 33,
75 DPY_PORT_OPEN_ERROR = 40,
76 DPY_PORT_CLOSE_ERROR = 41,
77 DPY_PORT_OPEN_LOCK_ERROR = 42,
85 #define ERROR_PARSE {ec=DPY_FILE_JSON_PARSE_ERROR;return false;} 95 class dpyError:
public boost::system::error_category
104 virtual const char *
name() const noexcept
117 return "Successful operation.";
119 return "Referenced item does not exist or could not be found.";
120 case DPY_FORMAT_ERROR:
121 return "Format obtained does not meet the expected requirements";
123 return "An overflow occurred or would have occurred.";
124 case DPY_UNAVAILABLE:
125 return "A transient or temporary loss of a service or resource.";
127 return "The process, operation, data stream, session, etc. has stopped.";
129 return "An IO operation failed.";
131 return "Communications error.";
133 return "A time-out occurred.";
134 case DPY_OUT_OF_RANGE:
135 return "An index or other value is out of range.";
137 return "Insufficient memory is available.";
138 case DPY_NOT_PERMITTED:
139 return "Requested action not permitted.";
141 return "Duplicate entry found or operation already performed.";
142 case DPY_BAD_PARAMETER:
143 return "Invalid parameter (out of range or invalid type).";
145 return "The resource is closed.";
147 return "The resource is busy.";
148 case DPY_UNSUPPORTED:
149 return "The underlying resource does not support this operation.";
150 case DPY_NOT_IMPLEMENTED:
151 return "Unimplemented functionality.";
153 return "Call has no effect.";
154 case DPY_COULD_NOT_OBTAIN_VALUE:
155 return "The value could not be obtained";
156 case DPY_EMPTY_MESSAGE:
157 return "The message is empty";
158 case DPY_PARSE_ERROR:
159 return "There was an error during parsing";
160 case DPY_COMMAND_ERROR:
161 return "Expected command response could not be received";
162 case DPY_INVALID_VALUE:
163 return "The value requested is not valid";
165 return "The operation requested is missing one or more parameters";
166 case DPY_CONFIG_ERROR:
167 return "Configuration error occurred";
169 return "The requested service is not ready yet";
170 case DPY_INVALID_CHECKSUM:
171 return "Checksum calculation has thrown an error";
172 case DPY_REQUEST_PROCESSED:
173 return "The request was processed but the result of the operation can't be known";
174 case DPY_REQUEST_DEFERRED:
175 return "The request was received and will be processed as soon as possible ";
176 case DPY_FILE_COULD_NOT_BE_OPENED:
177 return "File could not be opened.";
178 case DPY_FILE_DOES_NOT_EXIST:
179 return "File does not exist";
180 case DPY_FILE_CORRUPTED:
181 return "File is corrupted";
182 case DPY_FILE_JSON_PARSE_ERROR:
183 return "The json file could not be parsed";
184 case DPY_PORT_OPEN_ERROR:
185 return "Could not open the port";
186 case DPY_PORT_CLOSE_ERROR:
187 return "Could not close the port";
188 case DPY_PORT_OPEN_LOCK_ERROR:
189 return "Could not open the port, it is locked by another application";
191 return "Exception occurred while performing operation";
193 return "unknown custom::category error";
195 return "unknown custom::category error";
199 inline const boost::system::error_category& get_dpy_error_category();
200 static const boost::system::error_category& dpy_error_category = get_dpy_error_category();
202 const boost::system::error_category& get_dpy_error_category()
209 inline boost::system::error_code make_error_code(dpy_errors e)
211 return boost::system::error_code(static_cast<int>(e), dpy_error_category);
222 struct is_error_code_enum<dpy_errors>
227 BOOST_STATIC_CONSTANT(
bool, value =
true);
Definition: dpyError.h:214
virtual const char * name() const noexcept
Returns the name of the category.
Definition: dpyError.h:104
Allows to categorize the errors.
Definition: dpyError.h:95
virtual std::string message(int e) const
Return the error message according to the error value.
Definition: dpyError.h:113