Class VergilErrorHandler

  • All Implemented Interfaces:
    ErrorHandler

    public class VergilErrorHandler
    extends java.lang.Object
    implements ErrorHandler
    This error handler attempts to replace any failed MoML elements with generic versions so that the parsing of the MoML can continue. The generic versions, where appropriate, have icons that indicate failure.
    Since:
    Ptolemy II 2.0
    Version:
    $Id$
    Author:
    Edward A. Lee
    Pt.AcceptedRating:
    Red (reviewmoderator)
    Pt.ProposedRating:
    Red (eal)
    • Constructor Detail

      • VergilErrorHandler

        public VergilErrorHandler()
    • Method Detail

      • enableErrorSkipping

        public void enableErrorSkipping​(boolean enable)
        Enable or disable skipping of errors. If this method is called with a true argument, then do not report subsequent errors when handleError() is called, and instead return CONTINUE. If it is called with a false argument, then report all subsequent errors.

        This method is intended to be used when an operation may trigger a large number of errors, and the user interface wishes to offer the user the option of ignoring them. This method should be called with a true argument before the operation begins, and then called with a false argument after the operation ends.

        Specified by:
        enableErrorSkipping in interface ErrorHandler
        Parameters:
        enable - True to enable skipping, false to disable.
      • handleError

        public int handleError​(java.lang.String element,
                               NamedObj context,
                               java.lang.Throwable exception)
        Handle an error.
        Specified by:
        handleError in interface ErrorHandler
        Parameters:
        element - The XML element that triggered the error.
        context - The container object for the element.
        exception - The exception that was thrown.
        Returns:
        CONTINUE to skip this element, CANCEL to abort processing of the XML, IGNORE to continue to process the XML as if nothing had happened, or RETHROW to request that the exception be rethrown.