summaryrefslogtreecommitdiff
path: root/zen/file_error.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2015-10-02 14:49:33 +0200
committerDaniel Wilhelm <daniel@wili.li>2015-10-02 14:49:33 +0200
commita6e9143baf48bdc093788545636570808f9c103c (patch)
treed223a9360134cd8105a96ee0faf5c2643bd9141b /zen/file_error.h
parent6.4 (diff)
downloadFreeFileSync-a6e9143baf48bdc093788545636570808f9c103c.tar.gz
FreeFileSync-a6e9143baf48bdc093788545636570808f9c103c.tar.bz2
FreeFileSync-a6e9143baf48bdc093788545636570808f9c103c.zip
6.5
Diffstat (limited to 'zen/file_error.h')
-rw-r--r--zen/file_error.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/zen/file_error.h b/zen/file_error.h
index 5d655239..cb5e3a7b 100644
--- a/zen/file_error.h
+++ b/zen/file_error.h
@@ -36,6 +36,15 @@ DEFINE_NEW_FILE_ERROR(ErrorFileLocked);
DEFINE_NEW_FILE_ERROR(ErrorDifferentVolume);
+//CAVEAT: evalulate global error code *before* "throw" statement which may overwrite error code
+//due to a memory allocation before it creates the thrown instance! (e.g. affects MinGW + Win XP!!!)
+inline
+void throwFileError(const std::wstring& msg, const std::wstring& functionName, const ErrorCode ec) //throw FileError
+{
+ throw FileError(msg, formatSystemError(functionName, ec));
+}
+
+
//----------- facilitate usage of std::wstring for error messages --------------------
//allow implicit UTF8 conversion: since std::wstring models a GUI string, convenience is more important than performance
bgstack15