Tiny simplification in wxWebRequestWinHTTP code
Add and use SetFailed(error) function for symmetry with the existing SetFailedWithLastError().
This commit is contained in:
@@ -109,7 +109,11 @@ private:
|
|||||||
|
|
||||||
void CreateResponse();
|
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;
|
friend class wxWebAuthChallengeWinHTTP;
|
||||||
|
|
||||||
|
@@ -196,7 +196,7 @@ void wxWebRequestWinHTTP::HandleCallback(DWORD dwInternetStatus,
|
|||||||
GetState() == wxWebRequest::State_Cancelled )
|
GetState() == wxWebRequest::State_Cancelled )
|
||||||
SetState(wxWebRequest::State_Cancelled);
|
SetState(wxWebRequest::State_Cancelled);
|
||||||
else
|
else
|
||||||
SetState(wxWebRequest::State_Failed, wxWinHTTPErrorToString(asyncResult->dwError));
|
SetFailed(asyncResult->dwError);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -252,9 +252,9 @@ void wxWebRequestWinHTTP::CreateResponse()
|
|||||||
SetFailedWithLastError();
|
SetFailedWithLastError();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWebRequestWinHTTP::SetFailedWithLastError()
|
void wxWebRequestWinHTTP::SetFailed(DWORD errorCode)
|
||||||
{
|
{
|
||||||
wxString failMessage = wxWinHTTPErrorToString(::GetLastError());
|
wxString failMessage = wxWinHTTPErrorToString(errorCode);
|
||||||
SetState(wxWebRequest::State_Failed, failMessage);
|
SetState(wxWebRequest::State_Failed, failMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user