diff options
author | Daniel Wilhelm <shieldwed@outlook.com> | 2016-10-29 11:34:19 +0200 |
---|---|---|
committer | Daniel Wilhelm <shieldwed@outlook.com> | 2016-10-29 11:34:19 +0200 |
commit | 8d66e8a2b8cfe4eef4b946a1ab64354dfd7da00b (patch) | |
tree | 48e94273d3ee6b9d755e0081c46d29a387871611 /zen/sys_error.h | |
parent | 8.3 (diff) | |
download | FreeFileSync-8d66e8a2b8cfe4eef4b946a1ab64354dfd7da00b.tar.gz FreeFileSync-8d66e8a2b8cfe4eef4b946a1ab64354dfd7da00b.tar.bz2 FreeFileSync-8d66e8a2b8cfe4eef4b946a1ab64354dfd7da00b.zip |
8.4
Diffstat (limited to 'zen/sys_error.h')
-rw-r--r-- | zen/sys_error.h | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/zen/sys_error.h b/zen/sys_error.h index 16e59266..5897b413 100644 --- a/zen/sys_error.h +++ b/zen/sys_error.h @@ -1,8 +1,8 @@ -// ************************************************************************** -// * This file is part of the FreeFileSync project. It is distributed under * -// * GNU General Public License: http://www.gnu.org/licenses/gpl-3.0 * -// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved * -// ************************************************************************** +// ***************************************************************************** +// * This file is part of the FreeFileSync project. It is distributed under * +// * GNU General Public License: http://www.gnu.org/licenses/gpl-3.0 * +// * Copyright (C) Zenju (zenju AT freefilesync DOT org) - All Rights Reserved * +// ***************************************************************************** #ifndef SYS_ERROR_H_3284791347018951324534 #define SYS_ERROR_H_3284791347018951324534 @@ -25,15 +25,15 @@ namespace zen { //evaluate GetLastError()/errno and assemble specific error message #ifdef ZEN_WIN - typedef DWORD ErrorCode; + using ErrorCode = DWORD; #elif defined ZEN_LINUX || defined ZEN_MAC - typedef int ErrorCode; + using ErrorCode = int; #endif ErrorCode getLastError(); std::wstring formatSystemError(const std::wstring& functionName, ErrorCode ec); -std::wstring formatSystemError(const std::wstring& functionName, ErrorCode ec, const std::wstring& errorMsg); +std::wstring formatSystemError(const std::wstring& functionName, const std::wstring& errorCode, const std::wstring& errorMsg); //A low-level exception class giving (non-translated) detail information only - same conceptional level like "GetLastError()"! class SysError @@ -102,13 +102,16 @@ std::wstring formatSystemErrorRaw(ErrorCode ec) //return empty string on error std::wstring formatSystemError(const std::wstring& functionName, long long lastError) = delete; //intentional overload ambiguity to catch usage errors with HRESULT! inline -std::wstring formatSystemError(const std::wstring& functionName, ErrorCode ec) { return formatSystemError(functionName, ec, formatSystemErrorRaw(ec)); } +std::wstring formatSystemError(const std::wstring& functionName, ErrorCode ec) +{ + return formatSystemError(functionName, numberTo<std::wstring>(ec), formatSystemErrorRaw(ec)); +} inline -std::wstring formatSystemError(const std::wstring& functionName, ErrorCode ec, const std::wstring& errorMsg) +std::wstring formatSystemError(const std::wstring& functionName, const std::wstring& errorCode, const std::wstring& errorMsg) { - std::wstring output = replaceCpy(_("Error Code %x:"), L"%x", numberTo<std::wstring>(ec)); + std::wstring output = replaceCpy(_("Error Code %x:"), L"%x", errorCode); if (!errorMsg.empty()) { |