summaryrefslogtreecommitdiff
path: root/zen/sys_error.cpp
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2020-04-18 17:00:42 +0000
committerB Stack <bgstack15@gmail.com>2020-04-18 17:00:42 +0000
commitb4ecf755bad016b0d7fbb277106887f405f6b600 (patch)
tree8cfcea5441be72ad92095a3887ded84d38f9ba11 /zen/sys_error.cpp
parentMerge branch '10.22' into 'master' (diff)
parentadd upstream 10.23 (diff)
downloadFreeFileSync-b4ecf755bad016b0d7fbb277106887f405f6b600.tar.gz
FreeFileSync-b4ecf755bad016b0d7fbb277106887f405f6b600.tar.bz2
FreeFileSync-b4ecf755bad016b0d7fbb277106887f405f6b600.zip
Merge branch '10.23' into 'master'10.23
add upstream 10.23 See merge request opensource-tracking/FreeFileSync!20
Diffstat (limited to 'zen/sys_error.cpp')
-rw-r--r--zen/sys_error.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/zen/sys_error.cpp b/zen/sys_error.cpp
index b802780b..f9747d45 100644
--- a/zen/sys_error.cpp
+++ b/zen/sys_error.cpp
@@ -162,29 +162,30 @@ std::wstring formatSystemErrorCode(ErrorCode ec)
ZEN_CHECK_CASE_FOR_CONSTANT(ERFKILL);
ZEN_CHECK_CASE_FOR_CONSTANT(EHWPOISON);
default:
- return replaceCpy(_("Error Code %x"), L"%x", numberTo<std::wstring>(ec));
+ return replaceCpy(_("Error code %x"), L"%x", numberTo<std::wstring>(ec));
}
}
}
-std::wstring zen::formatSystemError(const std::wstring& functionName, ErrorCode ec)
+std::wstring zen::formatSystemError(const std::string& functionName, ErrorCode ec)
{
return formatSystemError(functionName, formatSystemErrorCode(ec), getSystemErrorDescription(ec));
}
-std::wstring zen::formatSystemError(const std::wstring& functionName, const std::wstring& errorCode, const std::wstring& errorMsg)
+std::wstring zen::formatSystemError(const std::string& functionName, const std::wstring& errorCode, const std::wstring& errorMsg)
{
- std::wstring output = errorCode + L':';
+ std::wstring output = errorCode;
const std::wstring errorMsgFmt = trimCpy(errorMsg);
- if (!errorMsgFmt.empty())
- {
- output += L' ';
- output += errorMsgFmt;
- }
+ if (!errorCode.empty() && !errorMsgFmt.empty())
+ output += L": ";
+
+ output += errorMsgFmt;
+
+ if (!functionName.empty())
+ output += L" [" + utfTo<std::wstring>(functionName) + L']';
- output += L" [" + functionName + L']';
- return output;
+ return trimCpy(output);
}
bgstack15