org.eclipse.wst.jsdt.core

## Class JavaScriptModelException

- java.lang.Object
- - CoreException
  - - org.eclipse.wst.jsdt.core.JavaScriptModelException

    public class JavaScriptModelException
    extends CoreException

A checked exception representing a failure in the JavaScript model. JavaScript model exceptions contain a JavaScript-specific status object describing the cause of the exception.

This class is not intended to be subclassed by clients. Instances of this class are automatically created by the JavaScript model when problems arise, so there is generally no need for clients to create instances.

See Also:
  `IJavaScriptModelStatus`, `Provisional API: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.`

### Constructor Summary

Constructors
Constructor and Description
`JavaScriptModelException(CoreException exception)` Creates a JavaScript model exception for the given `CoreException`.
`JavaScriptModelException(java.lang.Throwable e, int code)` Creates a JavaScript model exception that wrappers the given `Throwable`.

### Method Summary

All Methods Instance Methods Concrete Methods
`java.lang.Throwable` `getException()` Returns the underlying `Throwable` that caused the failure.
`IJavaScriptModelStatus` `getJavaScriptModelStatus()` Returns the JavaScript model status object for this exception.
`boolean` `isDoesNotExist()` Returns whether this exception indicates that a JavaScript model element does not exist.
`void` `printStackTrace(java.io.PrintStream output)` Prints this exception's stack trace to the given print stream.
`void` `printStackTrace(java.io.PrintWriter output)` Prints this exception's stack trace to the given print writer.
`java.lang.String` `toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### JavaScriptModelException

    public JavaScriptModelException(java.lang.Throwable e,
                                    int code)

Creates a JavaScript model exception that wrappers the given `Throwable`. The exception contains a JavaScript-specific status object with severity `IStatus.ERROR` and the given status code.

Parameters:
  `e` - the `Throwable`
  `code` - one of the JavaScript-specific status codes declared in `IJavaScriptModelStatusConstants`
See Also:
  `IJavaScriptModelStatusConstants`, `org.eclipse.core.runtime.IStatus#ERROR`

#### JavaScriptModelException

    public JavaScriptModelException(CoreException exception)

Creates a JavaScript model exception for the given `CoreException`. Equivalent to `JavaScriptModelException(exception,IJavaScriptModelStatusConstants.CORE_EXCEPTION`.

Parameters:
  `exception` - the `CoreException`

### Method Detail

#### getException

    public java.lang.Throwable getException()

Returns the underlying `Throwable` that caused the failure.

Returns:
  the wrappered `Throwable`, or `null` if the direct case of the failure was at the JavaScript model layer

#### getJavaScriptModelStatus

    public IJavaScriptModelStatus getJavaScriptModelStatus()

Returns the JavaScript model status object for this exception. Equivalent to `(IJavaScriptModelStatus) getStatus()`.

Returns:
  a status object

#### isDoesNotExist

    public boolean isDoesNotExist()

Returns whether this exception indicates that a JavaScript model element does not exist. Such exceptions have a status with a code of `IJavaScriptModelStatusConstants.ELEMENT_DOES_NOT_EXIST` or `IJavaScriptModelStatusConstants.ELEMENT_NOT_ON_CLASSPATH`. This is a convenience method.

Returns:
  `true` if this exception indicates that a JavaScript model element does not exist
See Also:
  `IJavaScriptModelStatus.isDoesNotExist()`, `IJavaScriptModelStatusConstants.ELEMENT_DOES_NOT_EXIST`, `IJavaScriptModelStatusConstants.ELEMENT_NOT_ON_CLASSPATH`

#### printStackTrace

    public void printStackTrace(java.io.PrintStream output)

Prints this exception's stack trace to the given print stream.

Parameters:
  `output` - the print stream

#### printStackTrace

    public void printStackTrace(java.io.PrintWriter output)

Prints this exception's stack trace to the given print writer.

Parameters:
  `output` - the print writer

#### toString

    public java.lang.String toString()