Class ComFailException
public class ComFailException extends ComException
{
// Constructors
public ComFailException(int hr);
public ComFailException(int hr, String message);
public ComFailException(int hr, String source, String helpFile,
int helpContext);
public ComFailException(int hr, String description,
String source, String helpFile, int helpContext);
public ComFailException();
public ComFailException(String message);
}
This class wraps an HRESULT, the return type for most methods in the Component Object Model (COM). The default value of the HRESULT stored in a ComFailException object is E_FAIL (0x80004005L).
The values of system-defined HRESULTs can be found in WINERROR.H, which is included with the Microsoft® Platform SDK. For information on component-specific errors, refer to the documentation associated with the component.
For system-defined errors, the detail description stored in the ComException object is the string returned by the Win32® API function, FormatMessage. This function returns a brief description of the error. This description can be retrieved by calling the getMessage method that is defined by the Throwable class.
The following table lists some common HRESULT values:
Error
|
Meaning
|
Value
|
E_UNEXPECTED
|
Unexpected failure
|
0x8000FFFF
|
E_NOTIMPL
|
Not implemented
|
0x80004001
|
E_OUTOFMEMORY
|
Ran out of memory
|
0x8007000E
|
E_INVALIDARG
|
One or more arguments are invalid
|
0x80070057
|
E_NOINTERFACE
|
No such interface supported
|
0x80004002
|
E_POINTER
|
Invalid pointer
|
0x80004003
|
E_HANDLE
|
Invalid handle
|
0x80070006
|
E_ABORT
|
Operation aborted
|
0x80004004
|
E_FAIL
|
Unspecified error
|
0x80004005
|
E_ACCESSDENIED
|
General access denied error
|
0x80070005
|
E_NOTIMPL
|
Not implemented
|
0x80000001
|
DISP_E_UNKNOWNINTERFACE
|
Unknown interface
|
0x80020001
|
DISP_E_MEMBERNOTFOUND
|
Member not found
|
0x80020003
|
DISP_E_PARAMNOTFOUND
|
Parameter not found
|
0x80020004
|
DISP_E_TYPEMISMATCH
|
Type mismatch
|
0x80020005
|
DISP_E_UNKNOWNNAME
|
Unknown name
|
0x80020006
|
DISP_E_NONAMEDARGS
|
No named arguments
|
0x80020007
|
DISP_E_BADVARTYPE
|
Bad variable type
|
0x80020008
|
DISP_E_EXCEPTION
|
Exception occurred
|
0x80020009
|
DISP_E_OVERFLOW
|
Out of present range
|
0x8002000A
|
DISP_E_BADINDEX
|
Invalid index
|
0x8002000B
|
DISP_E_UNKNOWNLCID
|
Memory is locked
|
0x8002000C
|
DISP_E_ARRAYISLOCKED
|
Memory is locked
|
0x8002000D
|
DISP_E_BADPARAMCOUNT
|
Invalid number of parameters
|
0x8002000E
|
DISP_E_PARAMNOTOPTIONAL
|
Parameter not optional
|
0x8002000F
|
DISP_E_BADCALLEE
|
Invalid callee
|
0x80020010
|
DISP_E_NOTACOLLECTION
|
Does not support a collection
|
0x80020011 |
RuntimeException
|
+--ComException
|
+--ComFailException
public ComFailException(int hr);
Creates a ComFailException object that contains the specified HRESULT.
Parameter | Description |
hr
| The HRESULT value that is returned.
|
public ComFailException(int hr, String message);
Creates a ComFailException object that contains the specified HRESULT and detail description.
Parameter | Description |
hr
| The HRESULT value that is returned.
|
message
| The detail description.
|
public ComFailException(int hr, String source, String helpFile,
int helpContext);
Creates a ComFailException object that contains the specified HRESULT, source, help file, and help context.
Parameter | Description |
hr
| The HRESULT value that is returned.
|
source
| The source of the ComFailException object.
|
helpFile
| The help file for the ComFailException object.
|
helpContext
| The identifier that indicates the context of the exception.
|
public ComFailException(int hr, String description, String source,
String helpFile, int helpContext);
Creates a ComFailException object that contains the specified HRESULT, description, source, Help file, and help context.
Parameter | Description |
hr
| The HRESULT value that is returned.
|
description
| The detail description.
|
source
| The source of the ComFailException object.
|
helpFile
| The help file for the ComFailException object.
|
helpContext
| The identifier that indicates the context of the exception.
|
public ComFailException();
Creates a ComFailException object. The default value of the HRESULT stored in the object is E_FAIL (0x80004005L).
public ComFailException(String message);
Creates a ComFailException object that contains the specified detail description. The default value of the HRESULT stored in the object is E_FAIL (0x80004005L).
Parameter | Description |
message
| The detail description.
|