diff --git a/include/wx/msw/private/webrequest_winhttp.h b/include/wx/msw/private/webrequest_winhttp.h index ad21393ec1..91620bc444 100644 --- a/include/wx/msw/private/webrequest_winhttp.h +++ b/include/wx/msw/private/webrequest_winhttp.h @@ -109,7 +109,11 @@ private: void CreateResponse(); - void SetFailedWithLastError(); + // Retrieve the error message corresponding to the given error and set the + // state to failed with this message as error string. + void SetFailed(DWORD errorCode); + + void SetFailedWithLastError() { SetFailed(::GetLastError()); } friend class wxWebAuthChallengeWinHTTP; diff --git a/src/msw/webrequest_winhttp.cpp b/src/msw/webrequest_winhttp.cpp index 46ed71bd7a..49532ea78a 100644 --- a/src/msw/webrequest_winhttp.cpp +++ b/src/msw/webrequest_winhttp.cpp @@ -196,7 +196,7 @@ void wxWebRequestWinHTTP::HandleCallback(DWORD dwInternetStatus, GetState() == wxWebRequest::State_Cancelled ) SetState(wxWebRequest::State_Cancelled); else - SetState(wxWebRequest::State_Failed, wxWinHTTPErrorToString(asyncResult->dwError)); + SetFailed(asyncResult->dwError); break; } } @@ -252,9 +252,9 @@ void wxWebRequestWinHTTP::CreateResponse() SetFailedWithLastError(); } -void wxWebRequestWinHTTP::SetFailedWithLastError() +void wxWebRequestWinHTTP::SetFailed(DWORD errorCode) { - wxString failMessage = wxWinHTTPErrorToString(::GetLastError()); + wxString failMessage = wxWinHTTPErrorToString(errorCode); SetState(wxWebRequest::State_Failed, failMessage); }