aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/Error.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-17 18:46:56 +0200
committerMax Kellermann <max@duempel.org>2013-10-17 19:29:38 +0200
commitf6d74012b7a583bddf2e3b824193ade91fe09ce7 (patch)
tree320e8bfe60bd03185124962fae6cfc330b84bf86 /src/util/Error.cxx
parent32dfc11c23ec89a994ec92a98e2f9a5c0fbd93db (diff)
downloadmpd-f6d74012b7a583bddf2e3b824193ade91fe09ce7.tar.gz
mpd-f6d74012b7a583bddf2e3b824193ade91fe09ce7.tar.xz
mpd-f6d74012b7a583bddf2e3b824193ade91fe09ce7.zip
util/Error: add method SetLastError()
Diffstat (limited to '')
-rw-r--r--src/util/Error.cxx16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/util/Error.cxx b/src/util/Error.cxx
index 1e6bd9cff..5675f4d81 100644
--- a/src/util/Error.cxx
+++ b/src/util/Error.cxx
@@ -29,6 +29,10 @@
const Domain errno_domain("errno");
+#ifdef WIN32
+const Domain win32_domain("win32");
+#endif
+
Error::~Error() {}
void
@@ -112,3 +116,15 @@ Error::FormatErrno(const char *fmt, ...)
SetErrno(e, buffer);
}
+
+#ifdef WIN32
+
+void
+Error::SetLastError(const char *prefix)
+{
+ DWORD _code = GetLastError();
+ const char *msg = g_win32_error_message(_code);
+ Format(win32_domain, int(_code), "%s: %s", prefix, msg);
+}
+
+#endif