Skip to content

Commit

Permalink
Shorten updater error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Norbyte committed Jan 5, 2020
1 parent 896a209 commit fdf79df
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions OsiLoader/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class OsiLoader

if (!updated && !ExtenderDLLExists()) {
completed_ = true;
auto msg = FromUTF8("Osiris Extender initialization failed:\r\n" + reason);
auto msg = FromUTF8(reason);
gErrorUtils->ShowError(msg.c_str());
return;
}
Expand All @@ -60,8 +60,7 @@ class OsiLoader

if (handle == NULL) {
auto errc = GetLastError();
std::wstring errmsg = L"Osiris Extender initialization failed:\r\n"
"Unable to load extender DLL.\r\n"
std::wstring errmsg = L"Script Extender DLL load failed.\r\n"
"Error code: ";
errmsg += std::to_wstring(errc);
gErrorUtils->ShowError(errmsg.c_str());
Expand All @@ -76,8 +75,7 @@ class OsiLoader

std::string etag;
if (!fetcher.FetchETag(packageUri.c_str(), etag)) {
reason = "Something went wrong while checking for updates. Please make sure you're connected to the internet and try again\r\n";
reason += "ETag fetch failed.\r\n";
reason = "Something went wrong while checking for Script Extender updates. Please make sure you're connected to the internet and try again\r\n";
reason += fetcher.GetLastError();
return false;
}
Expand All @@ -89,8 +87,7 @@ class OsiLoader

std::vector<uint8_t> response;
if (!fetcher.Fetch(packageUri.c_str(), response)) {
reason = "Something went wrong while downloading updates. Please make sure you're connected to the internet and try again\r\n";
reason += "Update payload fetch failed.\r\n";
reason = "Something went wrong while downloading Script Extender updates. Please make sure you're connected to the internet and try again\r\n";
reason += fetcher.GetLastError();
return false;
}
Expand All @@ -105,15 +102,15 @@ class OsiLoader
return true;
} else {
if (hr == S_FALSE) {
reason = "Unable to extract update package.\r\n";
reason = "Unable to extract Script Extender update package.\r\n";
reason += unzipReason;
} else {
_com_error err(hr);
LPCTSTR errMsg = err.ErrorMessage();

std::stringstream ss;
ss << "Unable to extract update package.\r\n"
<< "UnzipToFolder returned HRESULT 0x"
ss << "Unable to extract Script Extender update package.\r\n"
<< "HRESULT 0x"
<< std::hex << std::setw(8) << std::setfill('0') << hr;
if (errMsg != nullptr) {
ss << ": " << ToUTF8(errMsg);
Expand Down

0 comments on commit fdf79df

Please sign in to comment.