Provide descriptions for WinHTTP error messages

Just the error code is not very useful as it doesn't say anything about
what exactly failed, e.g. seeing "The buffers supplied to a function was
too small." doesn't help understanding which function was passed a too
small buffer, so add an extra parameter to SetFailed[WithLastError]() to
log this information too.

Also log the error code itself, because SEC_E_BUFFER_TOO_SMALL is
arguably more clear than its ungrammatical error message.

No real changes.

Closes https://github.com/wxWidgets/wxWidgets/pull/2247
This commit is contained in:
Vadim Zeitlin
2021-02-22 00:16:39 +01:00
parent 2c9f6770a5
commit 0728262640
2 changed files with 24 additions and 18 deletions

View File

@@ -114,11 +114,15 @@ private:
void CreateResponse();
// 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);
// Set the state to State_Failed with the error string including the
// provided description of the operation and the error message for this
// error code.
void SetFailed(const wxString& operation, DWORD errorCode);
void SetFailedWithLastError() { SetFailed(::GetLastError()); }
void SetFailedWithLastError(const wxString& operation)
{
SetFailed(operation, ::GetLastError());
}
friend class wxWebAuthChallengeWinHTTP;