summaryrefslogtreecommitdiff
path: root/lib/common
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2011-03-27 20:30:31 +0000
committerChris Wilson <chris+github@qwirx.com>2011-03-27 20:30:31 +0000
commit2b7ecda029aeeb1e9c1f586b3635c1b539f7671b (patch)
tree4aba7a8c37474271a10321c8bea1bb0c7bd417c0 /lib/common
parent28b61af7bdf2131a6a502b077615130bf1d66e57 (diff)
Add some macros for Windows specific error logging.
Diffstat (limited to 'lib/common')
-rw-r--r--lib/common/Logging.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/common/Logging.h b/lib/common/Logging.h
index 47045a50..b1301743 100644
--- a/lib/common/Logging.h
+++ b/lib/common/Logging.h
@@ -42,7 +42,8 @@
{ BOX_LOG(Log::TRACE, stuff) }
#define BOX_SYS_ERRNO_MESSAGE(error_number, stuff) \
- stuff << ": " << std::strerror(error_number) << " (" << errno << ")"
+ stuff << ": " << std::strerror(error_number) << \
+ " (" << error_number << ")"
#define BOX_FILE_MESSAGE(filename, message) \
message << ": " << filename
@@ -103,6 +104,14 @@ inline std::string GetNativeErrorMessage()
BOX_WARNING(stuff << ": " << GetErrorMessage(number))
#define BOX_LOG_NATIVE_ERROR(stuff) BOX_LOG_WIN_ERROR(stuff)
#define BOX_LOG_NATIVE_WARNING(stuff) BOX_LOG_WIN_WARNING(stuff)
+ #define BOX_WIN_ERRNO_MESSAGE(error_number, stuff) \
+ stuff << ": " << GetErrorMessage(error_number) << " (" << error_number << ")"
+ #define THROW_WIN_ERROR_NUMBER(message, error_number, exception, subtype) \
+ THROW_EXCEPTION_MESSAGE(exception, subtype, \
+ BOX_WIN_ERRNO_MESSAGE(error_number, message))
+ #define THROW_WIN_FILE_ERRNO(message, filename, error_number, exception, subtype) \
+ THROW_WIN_ERROR_NUMBER(BOX_FILE_MESSAGE(filename, message), \
+ error_number, exception, subtype)
#else
#define BOX_LOG_NATIVE_ERROR(stuff) BOX_LOG_SYS_ERROR(stuff)
#define BOX_LOG_NATIVE_WARNING(stuff) BOX_LOG_SYS_WARNING(stuff)