Package com.ms.com Previous
Previous
Contents
Contents
Index
Index
Next
Next

Class ComException

Constructors , Methods , Fields

public abstract class ComException extends RuntimeException {
  // Fields
  protected int hr;
  protected String m_source;
  protected String m_helpFile;
  protected int    m_helpContext;
  // Constructors
  public ComException(int hr)
  public ComException(int hr, String description)
  public ComException(int hr, String source, String helpFile, int helpContext)
  public ComException(int hr, String description, String source, String helpFile, int helpContext)
  public ComException()
  public ComException(String description)
  // Methods
  public int getHResult()
  public String getSource()
  public String getHelpFile()
  public int getHelpContext()
}

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

When implementing COM classes using Java, ComException objects are thrown to signal error conditions. Because ComException is an abstract class, a ComException object cannot be constructed directly. However, a ComFailException object or a ComSuccessException object can be constructed.


Constructors


ComException

public ComException(int hr)

Stores a ComException.

ParameterDescription
hr The HRESULT value to be returned.


ComException

public ComException(int hr, String description)

Stores a ComException.

ParameterDescription
hr The HRESULT value to be returned.
description The detail description.


ComException

public ComException(int hr, String source, String helpFile, int helpContext)

Stores a ComException.

ParameterDescription
hr The HRESULT value to be returned.
source The source of the ComException.
helpFile The help file for the ComException.
helpContext The help context of the ComException.


ComException

public ComException(int hr, String description, String source, String helpFile, int helpContext)

Stores a ComException.

ParameterDescription
hr The HRESULT value to be returned.
description The detail description.
source The source of the ComException.
helpFile The help file for the ComException.
helpContext The help context of the ComException.


ComException

public ComException()

Stores a ComException.


ComException

public ComException(String description)

Stores a ComException.

ParameterDescription
description The detail description.


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.

Return Value:

Returns the HRESULT returned by the COM method.


getSource

public String getSource()

Retrieves the source of the ComException.

Return Value:

Returns the source of the ComException.


getHelpFile

public String getHelpFile()

Retrieves the help file for the ComException.

Return Value:

Returns the help file for the ComException.


getHelpContext

public int getHelpContext()

Retrieves the help context of the ComException.

Return Value:

Returns the help context of the ComException.


Fields

hr
The HRESULT value.
m_source
The source of the ComException.
m_helpFile
The helpFile for the ComException.
m_helpContext
The helpContext for the ComException.


Top© 1997 Microsoft Corporation. All rights reserved. Legal Notices.