diff options
Diffstat (limited to 'zen/file_error.h')
-rw-r--r-- | zen/file_error.h | 9 |
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 |