Class CoreException

    • Constructor Detail

      • CoreException

        public CoreException​(IStatus status)
        Creates a new exception with the given status object. The message of the given status is used as the exception message.
        Parameters:
        status - the status object to be associated with this exception
    • Method Detail

      • getCause

        public Throwable getCause()
        Returns the cause of this exception, or null if none.
        Overrides:
        getCause in class Throwable
        Returns:
        the cause for this exception
        Since:
        3.4
      • getStatus

        public final IStatus getStatus()
        Returns the status object for this exception.

        IMPORTANT:
        The result must NOT be used for logging, error reporting, or as a method return value, since that code pattern hides the original stack trace. Instead, create a new Status with your plug-in ID and this CoreException, and use that new status for error reporting or as a method return value. For example, instead of:

              yourPlugin.getLog().log(exception.getStatus());
           
        Use:
              IStatus result = new Status(exception.getStatus().getSeverity(), pluginId, message, exception);
              yourPlugin.getLog().log(result);
           
        Returns:
        a status object
      • printStackTrace

        public void printStackTrace()
        Prints a stack trace out for the exception, and any nested exception that it may have embedded in its Status object.
        Overrides:
        printStackTrace in class Throwable
      • printStackTrace

        public void printStackTrace​(PrintStream output)
        Prints a stack trace out for the exception, and any nested exception that it may have embedded in its Status object.
        Overrides:
        printStackTrace in class Throwable
        Parameters:
        output - the stream to write to
      • printStackTrace

        public void printStackTrace​(PrintWriter output)
        Prints a stack trace out for the exception, and any nested exception that it may have embedded in its Status object.
        Overrides:
        printStackTrace in class Throwable
        Parameters:
        output - the stream to write to