Package org.eclipse.cdt.core.model
Class CModelException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- org.eclipse.core.runtime.CoreException
-
- org.eclipse.cdt.core.model.CModelException
-
- All Implemented Interfaces:
Serializable
public class CModelException extends org.eclipse.core.runtime.CoreException
A checked exception representing a failure in the C model. C model exceptions contain a C-specific status object describing the cause of the exception.- See Also:
ICModelStatus
,ICModelStatusConstants
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CModelException(Throwable e, int code)
Creates a C model exception that wrappers the givenThrowable
.CModelException(ICModelStatus status)
Creates a C model exception for the given C-specific status object.CModelException(org.eclipse.core.runtime.CoreException exception)
Creates a C model exception for the givenCoreException
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
doesNotExist()
Returns whether this exception indicates that a C model element does not exist.ICModelStatus
getCModelStatus()
Returns the C model status object for this exception.Throwable
getException()
Returns the underlyingThrowable
that caused the failure.String
toString()
Returns a printable representation of this exception suitable for debugging purposes only.-
Methods inherited from class org.eclipse.core.runtime.CoreException
getCause, getStatus, printStackTrace, printStackTrace, printStackTrace
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, setStackTrace
-
-
-
-
Constructor Detail
-
CModelException
public CModelException(Throwable e, int code)
Creates a C model exception that wrappers the givenThrowable
. The exception contains a C-specific status object with severityIStatus.ERROR
and the given status code.- Parameters:
e
- theThrowable
code
- one of the C-specific status codes declared inICModelStatusConstants
- See Also:
ICModelStatusConstants
,IStatus.ERROR
-
CModelException
public CModelException(org.eclipse.core.runtime.CoreException exception)
Creates a C model exception for the givenCoreException
. Equivalent toCModelException(exception,ICModelStatusConstants.CORE_EXCEPTION
.- Parameters:
exception
- theCoreException
-
CModelException
public CModelException(ICModelStatus status)
Creates a C model exception for the given C-specific status object.- Parameters:
status
- the C-specific status object
-
-
Method Detail
-
getException
public Throwable getException()
Returns the underlyingThrowable
that caused the failure.- Returns:
- the wrapped
Throwable
, ornull
if the direct case of the failure was at the C model layer
-
getCModelStatus
public ICModelStatus getCModelStatus()
Returns the C model status object for this exception. Equivalent to(ICModelStatus) getStatus()
.- Returns:
- a status object
-
doesNotExist
public boolean doesNotExist()
Returns whether this exception indicates that a C model element does not exist. Such exceptions have a status with a code ofICModelStatusConstants.ELEMENT_DOES_NOT_EXIST
. This is a convenience method.- Returns:
true
if this exception indicates that a C model element does not exist- See Also:
ICModelStatus.doesNotExist()
,ICModelStatusConstants.ELEMENT_DOES_NOT_EXIST
-
-