summaryrefslogtreecommitdiff
path: root/zen/sys_error.cpp
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2020-04-18 12:59:51 -0400
committerB Stack <bgstack15@gmail.com>2020-04-18 12:59:51 -0400
commitfc8cd27e4c0c8a48ebc151f73639a573e9e5c7f0 (patch)
tree8cfcea5441be72ad92095a3887ded84d38f9ba11 /zen/sys_error.cpp
parentMerge branch '10.22' into 'master' (diff)
downloadFreeFileSync-fc8cd27e4c0c8a48ebc151f73639a573e9e5c7f0.tar.gz
FreeFileSync-fc8cd27e4c0c8a48ebc151f73639a573e9e5c7f0.tar.bz2
FreeFileSync-fc8cd27e4c0c8a48ebc151f73639a573e9e5c7f0.zip
add upstream 10.23
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