com.jniwrapper.win32.com
Class ComException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.jniwrapper.JNIWrapperException
com.jniwrapper.win32.com.ComException
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- AutomationException
- public class ComException
- extends JNIWrapperException
This exception class is used for indicating errors occurred on the COM side.
- See Also:
- Serialized Form
Constructor Summary |
ComException(int hResult)
Constructs a new instance with the passed error code. |
ComException(int hResult,
IErrorInfo errInfo)
Constructs a new instance with the passed error code. |
Methods inherited from class java.lang.Throwable |
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ComException
public ComException(int hResult)
- Constructs a new instance with the passed error code.
- Parameters:
hResult
- error code
ComException
public ComException(int hResult,
IErrorInfo errInfo)
- Constructs a new instance with the passed error code.
- Parameters:
hResult
- error codeerrInfo
- error info
getHResult
public int getHResult()
- Returns:
- the error code associated with the exception.
getErrorInfo
public IErrorInfo getErrorInfo()
- Returns:
- IErrorInfo, null if not available
getHResultHex
public java.lang.String getHResultHex()
- Returns:
- hexadecimal representation of the error code.
checkResult
public static void checkResult(HResult result)
throws ComException
- Utility method that verifies if the passed result code is less than zero.
If so, throws
ComException
with the value.
- Parameters:
result
- result code to check.
- Throws:
ComException
- if the result is less than zero.
createComException
public static ComException createComException(java.lang.Throwable e,
int hResult)