0

Where I can find the list of EDOMParseError.ErrorCode values?

I can't find it in Delphi source or in MSDN.

For example, if I set XMLDocument.FileName to incorrect url, I've got

Error code: -2146697210
Reason:  System error: -2146697210

Where this codes are defined?

Y.N
  • 4,989
  • 7
  • 34
  • 61

2 Answers2

2

When using MSXML as the DOM provider for TXMLDocument, the EDOMParseError.ErrorCode value is a COM HRESULT value (MSXML is implemented as COM objects). There is no single source that documents all possible HRESULT values. Different modules are allowed to define their own custom HRESULT values.

In this case, -2146697210 (hex 0x800C0006) is INET_E_OBJECT_NOT_FOUND (The object was not found):

#define INET_E_OBJECT_NOT_FOUND          _HRESULT_TYPEDEF_(0x800C0006L)      

This translates to an HRESULT defined via the MAKE_HRESULT() macro with a severity of SEVERITY_ERROR, a facility of FACILITY_INTERNET, and an error code of 6:

#define INET_E_OBJECT_NOT_FOUND          MAKE_HRESULT(SEVERITY_ERROR, FACILITY_INTERNET, 6)

This particular HESULT value is documented in URL Moniker Error Codes. All HRESULT values with a facility of FACILITY_INTERNET belong to the WinInet library, which includes the UrlMon module. MSXML uses WinInet internally to download remote content.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
0

As stated in the Reason, this error comes from your system.

SysErrorMessage(ErrorCode)

Should do what you want.

Call SysErrorMessage only if the error comes from the system. But now you need to figure out how to know this. Checking the Reason like this is possible

if reason.StartsWith('System Error') then
    errorMessage := SysErrorMessage(errorCode);

But it seems bad to do it this way (does it depends on the Windows language settings ?...)

Etsitpab Nioliv
  • 354
  • 1
  • 4
  • 15
  • I do not need the description for given code. I need the list of variants to case handle the parse fails. – Y.N Apr 11 '16 at 15:28
  • I don't know where you would find such a list. -2146697210 is $800C0006 in hex, and you'll find that mentioned in @RobKennedy's comment on this q: http://stackoverflow.com/questions/4346060/error-when-loading-valid-windows-1252-document-system-error-2146697210 – MartynA Apr 11 '16 at 15:57