MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / handle_error

Function handle_error

src/network.c:151–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149} multicast_receiver_priv_data;
150
151static void handle_error(enum rig_debug_level_e lvl, const char *msg)
152{
153 int e;
154#ifdef __MINGW32__
155 LPVOID lpMsgBuf;
156
157 lpMsgBuf = (LPVOID)"Unknown error";
158 e = WSAGetLastError();
159
160 if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER
161 | FORMAT_MESSAGE_FROM_SYSTEM
162 | FORMAT_MESSAGE_IGNORE_INSERTS,
163 NULL,
164 e,
165 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
166 // Default language
167 (LPTSTR)&lpMsgBuf,
168 0,
169 NULL))
170 {
171 rig_debug(lvl, "%s: Network error %d: %s\n", msg, e, (char *)lpMsgBuf);
172 LocalFree(lpMsgBuf);
173 }
174 else
175 {
176 rig_debug(lvl, "%s: Network error %d\n", msg, e);
177 }
178
179#else
180 e = errno;
181 rig_debug(lvl, "%s: Network error %d: %s\n", msg, e, strerror(e));
182#endif
183}
184
185#define TRACE rig_debug(RIG_DEBUG_ERR, "TRACE %s(%d)\n", __func__,__LINE__);
186

Callers 1

network_openFunction · 0.70

Calls 1

rig_debugFunction · 0.85

Tested by

no test coverage detected