Tell me more ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm trying to perform the following operation:

 IPropertySet addressProperties = reverseGeocoding.ReverseGeocode(point, false);

And I get this error: Exception from HRESULT: 0x80040217

Is there some function to get a human readable form of this error?
I'm using ArcEngine C# and VS2010.

share|improve this question

3 Answers

up vote 5 down vote accepted

Often you can use the ISupportErrorInfo interface and GetErrorInfo system call in conjunction; many classes implement this to provide human-readable exception data.

Also, some common HRESULT codes for geocoding.

share|improve this answer
Wow: GEOCODING_E_REVERSE_GEOCODE_NO_ADDRESS_FOUND. They really ought to have the HRESULTs on that page as well (I sent feedback on that page requesting that they include the HRESULT value, but I haven't had a lot of luck with sending feedback to them in the past). – Michael Todd Oct 19 '10 at 4:22
1  
There is no need to access ISupportErrorInfo in .NET, since any errors are translated to a COMException which, if the class implements ISupportErrorInfo, does include the available information. – Petr Krebs Feb 3 '11 at 8:59

COMException class has the ErrorCode property, which you can compare against any of the error code enumerations, for example esriGeocodingError.

share|improve this answer
Do you have any clever way of getting the enum string corresponding to the ErrorCode property in a generic way, like if you don't know in advance which enumeration it is in? – blah238 Aug 11 '11 at 22:59
I also see that the enumerations have summaries that could possibly be retrieved as well. Seems like there would be something built in to put 2 and 2 together... – blah238 Aug 11 '11 at 23:06
@blah238, did you ever develop a way to get the ErrorCode in a generic way? Also, do you know how to access each error enumeration's summary? I can see the summary when I hover over the enum in Vis Studio, but am not sure you to actually capture it programmatically. – rgwozdz Oct 1 '11 at 2:57

Convert the Hex code to Decimal.

I usually take these steps:

  1. Convert the HRESULT to binary

       8    0    0    4    0    2    1    7
    1000 0000 0000 0100 0000 0010 0001 0111
    
  2. Since the most significant digit is 1, the number is negative. We must calculate the 2's compliment. First, find the 1's compliment by NOT'ing the binary number.

    0111 1111 1111 1011 1111 1101 1110 1000
    
  3. Now add 1 to make the 2's compliment

    0111 1111 1111 1011 1111 1101 1110 1001
    
  4. Convert the new binary number to decmial (I use this page)

    -2147220969
    
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.