Package com.ms.com Previous
Previous
Microsoft Packages
Microsoft Packages
Index
Index
Next
Next

Class ComException

Constructors , Methods

public abstract class com.ms.com.ComException
    extends RuntimeException
{
    // Constructors
    public ComException();
    public ComException(int hr);
    public ComException(String message);
    public ComException(int hr, String message);

    // Methods
    public int getHResult();
}

ComException is the Java class that wraps an HRESULT, the return type for most methods in the Component Object Model (COM). When calling COM methods from Java, you catch ComException objects to handle error conditions. Note that ComException is derived from RuntimeException, so the compiler does not check whether methods throw ComException objects or not; it is up to your discretion as to when you should use try-catch blocks.

When implementing COM classes using Java, you throw ComException objects to signal error conditions. Since ComException is an abstract class, so you cannot construct a ComException object directly. Instead, you construct either a ComFailException object or a ComSuccessException object.

See also RuntimeException, ComFailException, ComSuccessException, package com.ms.com


Constructors


ComException

public ComException( );
public ComException( int hr );
public ComException( String message );
public ComException( int hr, String message );

Constructs a new ComException object. Because ComException is an abstract class, this constructor is called only by the constructors of the classes derived from ComException.

ParameterDescription
hr The HRESULT to return.
message The detail message.


Methods


getHResult

public int getHResult( );

Retrieves the HRESULT returned by the COM method. Call this method when catching a ComException thrown by a COM method.



Top© 1996 Microsoft Corporation. All rights reserved.