Skip to content

Commit 0826bad

Browse files
committed
Added WinHTTP error codes to FACILITY_WIN32
1 parent d40a035 commit 0826bad

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

src/Elmah.Io.HResults/Facilities/FacilityWin32Resolver.cs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ namespace Elmah.Io.HResults.Facilities
22
{
33
// Sources:
44
// - https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d
5+
// - https://learn.microsoft.com/en-us/windows/win32/winhttp/error-messages
56
internal class FacilityWin32Resolver : FacilityResolverBase
67
{
78
public FacilityWin32Resolver() : base(7, "FACILITY_WIN32")
@@ -2429,6 +2430,52 @@ internal override Code Resolve(bool failure, int code)
24292430
11029 => new Code(code, "WSA_QOS_ESDMODEOBJ", "An invalid shape discard mode object was found in the QOS provider-specific buffer."),
24302431
11030 => new Code(code, "WSA_QOS_ESHAPERATEOBJ", "An invalid shaping rate object was found in the QOS provider-specific buffer."),
24312432
11031 => new Code(code, "WSA_QOS_RESERVED_PETYPE", "A reserved policy element was found in the QOS provider-specific buffer."),
2433+
12178 => new Code(code, "ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR", "Returned by WinHttpGetProxyForUrl when a proxy for the specified URL cannot be located."),
2434+
12180 => new Code(code, "ERROR_WINHTTP_AUTODETECTION_FAILED", "Returned by WinHttpDetectAutoProxyConfigUrl if WinHTTP was unable to discover the URL of the Proxy Auto-Configuration (PAC) file."),
2435+
12166 => new Code(code, "ERROR_WINHTTP_BAD_AUTO_PROXY_SCRIPT", "An error occurred executing the script code in the Proxy Auto-Configuration (PAC) file."),
2436+
12103 => new Code(code, "ERROR_WINHTTP_CANNOT_CALL_AFTER_OPEN", "Returned by the HttpRequest object if a specified option cannot be requested after the Open method has been called."),
2437+
12102 => new Code(code, "ERROR_WINHTTP_CANNOT_CALL_AFTER_SEND", "Returned by the HttpRequest object if a requested operation cannot be performed after calling the Send method."),
2438+
12100 => new Code(code, "ERROR_WINHTTP_CANNOT_CALL_BEFORE_OPEN", "Returned by the HttpRequest object if a requested operation cannot be performed before calling the Open method."),
2439+
12101 => new Code(code, "ERROR_WINHTTP_CANNOT_CALL_BEFORE_SEND", "Returned by the HttpRequest object if a requested operation cannot be performed before calling the Send method."),
2440+
12029 => new Code(code, "ERROR_WINHTTP_CANNOT_CONNECT", "Returned if connection to the server failed."),
2441+
12183 => new Code(code, "ERROR_WINHTTP_CHUNKED_ENCODING_HEADER_SIZE_OVERFLOW", "Returned by WinHttpReceiveResponse when an overflow condition is encountered in the course of parsing chunked encoding."),
2442+
12044 => new Code(code, "ERROR_WINHTTP_CLIENT_AUTH_CERT_NEEDED", "Returned by WinHttpReceiveResponse when the server requests client authentication."),
2443+
12030 => new Code(code, "ERROR_WINHTTP_CONNECTION_ERROR", "The connection with the server has been reset or terminated, or an incompatible SSL protocol was encountered. For example, WinHTTP version 5.1 does not support SSL2 unless the client specifically enables it."),
2444+
12155 => new Code(code, "ERROR_WINHTTP_HEADER_ALREADY_EXISTS", "Obsolete; no longer used."),
2445+
12181 => new Code(code, "ERROR_WINHTTP_HEADER_COUNT_EXCEEDED", "Returned by WinHttpReceiveResponse when a larger number of headers were present in a response than WinHTTP could receive."),
2446+
12150 => new Code(code, "ERROR_WINHTTP_HEADER_NOT_FOUND", "The requested header cannot be located."),
2447+
12182 => new Code(code, "ERROR_WINHTTP_HEADER_SIZE_OVERFLOW", "Returned by WinHttpReceiveResponse when the size of headers received exceeds the limit for the request handle."),
2448+
12019 => new Code(code, "ERROR_WINHTTP_INCORRECT_HANDLE_STATE", "The requested operation cannot be carried out because the handle supplied is not in the correct state."),
2449+
12018 => new Code(code, "ERROR_WINHTTP_INCORRECT_HANDLE_TYPE", "The type of handle supplied is incorrect for this operation."),
2450+
12004 => new Code(code, "ERROR_WINHTTP_INTERNAL_ERROR", "An internal error has occurred."),
2451+
12009 => new Code(code, "ERROR_WINHTTP_INVALID_OPTION", "A request to WinHttpQueryOption or WinHttpSetOption specified an invalid option value."),
2452+
12154 => new Code(code, "ERROR_WINHTTP_INVALID_QUERY_REQUEST", "Obsolete; no longer used."),
2453+
12152 => new Code(code, "ERROR_WINHTTP_INVALID_SERVER_RESPONSE", "The server response cannot be parsed."),
2454+
12005 => new Code(code, "ERROR_WINHTTP_INVALID_URL", "The URL is not valid."),
2455+
12015 => new Code(code, "ERROR_WINHTTP_LOGIN_FAILURE", "The login attempt failed. When this error is encountered, the request handle should be closed with WinHttpCloseHandle. A new request handle must be created before retrying the function that originally produced this error."),
2456+
12007 => new Code(code, "ERROR_WINHTTP_NAME_NOT_RESOLVED", "The server name cannot be resolved."),
2457+
12172 => new Code(code, "ERROR_WINHTTP_NOT_INITIALIZED", "Obsolete; no longer used."),
2458+
12017 => new Code(code, "ERROR_WINHTTP_OPERATION_CANCELLED", "The operation was canceled, usually because the handle on which the request was operating was closed before the operation completed."),
2459+
12011 => new Code(code, "ERROR_WINHTTP_OPTION_NOT_SETTABLE", "The requested option cannot be set, only queried."),
2460+
12001 => new Code(code, "ERROR_WINHTTP_OUT_OF_HANDLES", "Obsolete; no longer used."),
2461+
12156 => new Code(code, "ERROR_WINHTTP_REDIRECT_FAILED", "The redirection failed because either the scheme changed or all attempts made to redirect failed (default is five attempts)."),
2462+
12032 => new Code(code, "ERROR_WINHTTP_RESEND_REQUEST", "The WinHTTP function failed. The desired function can be retried on the same request handle."),
2463+
12184 => new Code(code, "ERROR_WINHTTP_RESPONSE_DRAIN_OVERFLOW", "Returned when an incoming response exceeds an internal WinHTTP size limit."),
2464+
12177 => new Code(code, "ERROR_WINHTTP_SCRIPT_EXECUTION_ERROR", "An error was encountered while executing a script."),
2465+
12038 => new Code(code, "ERROR_WINHTTP_SECURE_CERT_CN_INVALID", "Returned when a certificate CN name does not match the passed value (equivalent to a CERT_E_CN_NO_MATCH error)."),
2466+
12037 => new Code(code, "ERROR_WINHTTP_SECURE_CERT_DATE_INVALID", "ndicates that a required certificate is not within its validity period when verifying against the current system clock or the timestamp in the signed file, or that the validity periods of the certification chain do not nest correctly (equivalent to a CERT_E_EXPIRED or a CERT_E_VALIDITYPERIODNESTING error)."),
2467+
12057 => new Code(code, "ERROR_WINHTTP_SECURE_CERT_REV_FAILED", "Indicates that revocation cannot be checked because the revocation server was offline (equivalent to CRYPT_E_REVOCATION_OFFLINE)."),
2468+
12170 => new Code(code, "ERROR_WINHTTP_SECURE_CERT_REVOKED", "Indicates that a certificate has been revoked (equivalent to CRYPT_E_REVOKED)."),
2469+
12179 => new Code(code, "ERROR_WINHTTP_SECURE_CERT_WRONG_USAGE", "Indicates that a certificate is not valid for the requested usage (equivalent to CERT_E_WRONG_USAGE)."),
2470+
12157 => new Code(code, "ERROR_WINHTTP_SECURE_CHANNEL_ERROR", "Indicates that an error occurred having to do with a secure channel (equivalent to error codes that begin with \"SEC_E_\" and \"SEC_I_\" listed in the \"winerror.h\" header file)."),
2471+
12175 => new Code(code, "ERROR_WINHTTP_SECURE_FAILURE", "One or more errors were found in the Secure Sockets Layer (SSL) certificate sent by the server. To determine what type of error was encountered, check for a WINHTTP_CALLBACK_STATUS_SECURE_FAILURE notification in a status callback function. For more information, see WINHTTP_STATUS_CALLBACK."),
2472+
12045 => new Code(code, "ERROR_WINHTTP_SECURE_INVALID_CA", "Indicates that a certificate chain was processed, but terminated in a root certificate that is not trusted by the trust provider (equivalent to CERT_E_UNTRUSTEDROOT)."),
2473+
12169 => new Code(code, "ERROR_WINHTTP_SECURE_INVALID_CERT", "Indicates that a certificate is invalid (equivalent to errors such as CERT_E_ROLE, CERT_E_PATHLENCONST, CERT_E_CRITICAL, CERT_E_PURPOSE, CERT_E_ISSUERCHAINING, CERT_E_MALFORMED and CERT_E_CHAINING)."),
2474+
12012 => new Code(code, "ERROR_WINHTTP_SHUTDOWN", "The WinHTTP function support is being shut down or unloaded."),
2475+
12002 => new Code(code, "ERROR_WINHTTP_TIMEOUT", "The request has timed out. This error can be returned as a result of TCP/IP time-out behavior, regardless of time-out values set in Windows HTTP Services."),
2476+
12167 => new Code(code, "ERROR_WINHTTP_UNABLE_TO_DOWNLOAD_SCRIPT", "The PAC file cannot be downloaded. For example, the server referenced by the PAC URL may not have been reachable, or the server returned a 404 NOT FOUND response."),
2477+
12176 => new Code(code, "ERROR_WINHTTP_UNHANDLED_SCRIPT_TYPE", "The script type is not supported."),
2478+
12006 => new Code(code, "ERROR_WINHTTP_UNRECOGNIZED_SCHEME", "The URL specified a scheme other than \"http:\" or \"https:\"."),
24322479
13000 => new Code(code, "ERROR_IPSEC_QM_POLICY_EXISTS", "The specified quick mode policy already exists."),
24332480
13001 => new Code(code, "ERROR_IPSEC_QM_POLICY_NOT_FOUND", "The specified quick mode policy was not found."),
24342481
13002 => new Code(code, "ERROR_IPSEC_QM_POLICY_IN_USE", "The specified quick mode policy is being used."),

0 commit comments

Comments
 (0)