Class RecorderErrorHandler

  • All Implemented Interfaces:
    ErrorHandler

    public class RecorderErrorHandler
    extends java.lang.Object
    implements ErrorHandler
    Record MoML Errors and retrieve them later.
    Since:
    Ptolemy II 4.0
    Version:
    $Id$
    Author:
    Christopher Hylands Brooks
    See Also:
    RecorderListener
    Pt.AcceptedRating:
    Red (reviewmoderator)
    Pt.ProposedRating:
    Red (eal)
    • Constructor Summary

      Constructors 
      Constructor Description
      RecorderErrorHandler()
      Create an error handler.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void enableErrorSkipping​(boolean enable)
      Enable or disable skipping of errors.
      java.lang.String getMessages()
      Get the messages recorded so far.
      int handleError​(java.lang.String element, NamedObj context, java.lang.Throwable exception)
      Handle an error by printing a description of the error to the stream specified in the constructor.
      void reset()
      Clear the buffer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RecorderErrorHandler

        public RecorderErrorHandler()
        Create an error handler.
    • Method Detail

      • enableErrorSkipping

        public void enableErrorSkipping​(boolean enable)
        Enable or disable skipping of errors. This method does nothing.
        Specified by:
        enableErrorSkipping in interface ErrorHandler
        Parameters:
        enable - True to enable skipping, false to disable.
      • getMessages

        public java.lang.String getMessages()
        Get the messages recorded so far.
        Returns:
        The messages.
      • handleError

        public int handleError​(java.lang.String element,
                               NamedObj context,
                               java.lang.Throwable exception)
        Handle an error by printing a description of the error to the stream specified in the constructor.
        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 request skipping this element.
      • reset

        public void reset()
        Clear the buffer.