ArcObjects error codes


This document was published with and applies to ArcGIS 9.3.
A 10 version also exists.
Summary The goal of this document is to give you an overview of HRESULTs as they relate to ArcObjects and help you decipher HRESULT error codes you receive while developing and programming. The first section of this document details what an HRESULT is and how to locate information on these error codes in the ArcGIS Engine Java SDK. The second section of this document provides detailed instructions for the number conversions that are often necessary when working with HRESULTs.

HRESULT Error Codes

When programming with ArcObjects in Java, you are making calls to COM components, and therefore receiving errors from COM components. All COM methods return an unsigned integer called an HRESULT. The HRESULT is essentially a structure that tells whether the method succeeded or failed, and contains additional detailed information about the outcome of the operation. HRESULT values are often used to return error information, but are not specifically considered error codes. When the underlying ArcObjects component returns an error condition as a HRESULT, the Java Interop wraps it in an instance of AutomationException. This AutomationException can be handled by using a Try, Catch, Finally block.
 
Most HRESULT error constants for ArcObjects libraries are documented in the table below
 
HRESULTs that are not specific to ArcObjects can be found on MSDN. For a listing of common MSDN HRESULT values, see http://msdn2.microsoft.com/en-us/library/aa378137.aspx.
 
Locating the HRESULT
 
The majority of the ESRI ArcObject's error code enumerations are in the 10-digit decimal format. However, three ArcObjects libraries utilize a 3-digit decimal value in the documentation instead of the 10-digit decimal value. These libraries are Geometry (esriGeometryError and esriSpatialReferenceError enumerations), Geodatabase (esriDataConverterError enumeration), and Editor (esriEditorError enumeration). 
 
AutomationException returns the HRESULT in either 8-digit hexadecimal form or 10-digit decimal form.
 

The stack trace provided by AutomationException returns the HRESULT as a 8-digit
hexadecimal. Use the steps provided below to convert this 8-digit hexadecimal value into a 3-digit/10-digit decimal value to reference the ArcObjects Error Codes.
 
AutomationException::getCode() returns the same HRESULT as a positive, 10-digit decimal value. This decimal value cannot be readily used to look up the ArcObjects Error Codes. It must be first converted into a 8-digit hexadecimal.  You can then
use the steps provided below to convert this 8-digit hexadecimal value into a 3-digit/10-digit decimal value to reference the ArcObjects Error Codes.
 
The table below lists all available error enumeration pages as well as the range of HRESULT values each library contains. If a particular library is not listed, there are no specific HRESULT error codes for that library at this time. Instead, you will receive a general COM error.
 
 
The Editor library is a part of ArcGIS Desktop, and is hence not available in the ArcGIS Engine Java API.
See Obtaining Decimal numbers from Hexadecimal values below for instructions on converting the 10-digit decimal value you receive to the 3-digit value found in the documentation.
ArcObjects HRESULT Error Codes:
Enumeration
Library
Min Value
Max Value
esriEditorError
Editor
514
514
Geodatabase
513
532
Geometry
513
602
Geometry
514
524
cadastralError
Cadastral
-2147221247
-2147220732
Carto
-2147220991
-2147220989
Carto
-2147220991
-2147220985
Carto
-2147217152
-2147217152
Carto
-2147216896
-2147216895
DataSourcesNetCDF
-2147217408
-2147217401
DataSourcesRaster
-2147217407
-2147217408
DataSourcesRaster
-2147217408
-2147217370
esriRasterEncoderError
DataSourcesRasterUI
-2147217408
-2147217403
Display
-2147218431
-2147218425
GeoAnalyst
-2147217408
-2147217248
Geodatabase
-2147220991
-2147220983
Geodatabase
-2147220991
-2147220879
Geodatabase
-2147220991
-2147212030
Geodatabase
-2147219456
-2147219388
Geodatabase
-2147218687
-2147218670
GeoDatabaseDistributed
-2147208551
-2147208540
GeoDatabaseExtensions
-2147205120
-2147219396
Location
-2147220991
-2147220969
Location
-2147220991
-2147220956
NetworkAnalysis
-2147220911
-2147220225
Output
-2147220735
-2147220719
Output
-2147220686
-2147220670
Schematic
-2147218943
-2147218923
esriSurveyDatabaseError
SurveyExt
-2147220992
-2147220969
esriSurveyAnalystCtrlsError
SurveyExt
-2147220736
-2147220735
esriSurveyComputationError
SurveyExt
-2147220480
-2147220479
esriSurveyTPSError
SurveyPkgs
-2147220736
-2147220733
System
-2147221247
-2147221243
System
-2147220991
-2147220967
TrackingAnalyst
-2147220480
-2147220352
TrackingAnalyst
-2147219456
-2147219392
TrackingAnalyst
-2147219199
-2147219135
 

Obtaining Decimal numbers from Hexadecimal values

 
Convert 8-digit hexadecimal to 10-digit decimal value
 
  1. Open the Windows Calculator. If you do not see Hex, Dec, Oct, and Bin radio buttons, go to View and select "Scientific."
  2. Select the "Hex" and "Dword" radio buttons.
  3. Type or paste in the 8-digit hexadecimal value (leave off the preceding "0x").
 
 
 
  1. Press the Not button
  2. Add one
 
 
 
  1. Press the Bin button
  2. Press the Dec button
  3. Press the +/- button
 
 
 
Convert 8-digit hexadecimal to 3-Digit enumeration values
If you have obtained the 8-digit hexadecimal value from the Geometry (esriGeometry and esriSpatialReference), Geodatabase (esriDataConverter), or Editor (esriEditor) libraries, follow these steps to obtain the 3-digit value.
 
  1. Open the Windows Calculator. If you do not see Hex, Dec, Oct, and Bin radio buttons, go to View and select "Scientific."
  2. Select the "Hex" and "Dword" radio buttons.
  3. Type or paste in the 8-digit hexadecimal value (leave off the preceding "0x").


  4. Press the And button and type in FFFF.
  5. Press the equals button.


  6. Click the Dec radio button for the conversion to the three-digit value for the error code


  7. Use that 3-digit code (520) to find the error on the library documentation page.