event/ServerSocket: migrate from class Error to C++ exceptions

This commit is contained in:
Max Kellermann
2016-10-28 10:36:05 +02:00
parent 16d1c9f5d6
commit aead221184
13 changed files with 164 additions and 188 deletions

View File

@@ -21,6 +21,7 @@
#define MPD_SOCKET_ERROR_HXX
#include "Compiler.h"
#include "system/Error.hxx"
#include "util/Error.hxx" // IWYU pragma: export
#ifdef WIN32
@@ -136,4 +137,22 @@ NewSocketError()
return NewSocketError(GetSocketError());
}
gcc_const
static inline std::system_error
MakeSocketError(socket_error_t code, const char *msg)
{
#ifdef WIN32
return MakeLastError(code, msg);
#else
return MakeErrno(code, msg);
#endif
}
gcc_pure
static inline std::system_error
MakeSocketError(const char *msg)
{
return MakeSocketError(GetSocketError(), msg);
}
#endif