Interface ErrorMsgOps


public interface ErrorMsgOps
Error message interface. This interface provides a common interface for reporting errors. Classes that implement this interface will determine where and how the error message is displayed.
  • Method Details

    • addSeparatorIfNeeded

      void addSeparatorIfNeeded()
      Add separator if needed.
    • addSeparator

      void addSeparator()
      Add a separator.
    • setStackTrace

      void setStackTrace(boolean value)
      Set stack-trace recording. Determines if a stack trace is shown when a Throwable is displayed.
      Parameters:
      value - true if stack traces should be recorded; false otherwise
      See Also:
    • stackTraceEnabled

      boolean stackTraceEnabled()
      Check if stack traces are enabled.
      Returns:
      true if stack traces are enabled; false otherwise
      See Also:
    • setAppendable

      void setAppendable(Appendable out)
      Set the Appendable recording error messages. The default is System.err. The method displayConsoleIfNeeded() will display a console if it is passed to this method and if it is an instance of SimpleConsole. To use the Java console for output (the TTY associated with a process on Unix/Linux), try setAppendable(System.console().writer()); however, normally one would just use System.err.
      Parameters:
      out - the Appendable for error messages; null for the default.
    • display

      void display(String fn, int lineno, String msg)
      Display a message with a file name and line number.
      Parameters:
      fn - the file name
      lineno - the line number
      msg - the message to display
    • display

      void display(String fn, String input, int index, Exception e, boolean verbose, boolean showLocation)
      Display an error message, based on an exception, with a line from some input. The default format in English shows the filename in quotes followed by the line number, the class for the exception, and the corresponding message. The next line contains a portion of the input, with a subsequent line including a caret indicating the point where the error occurred, followed by some information about the column number.
      Parameters:
      fn - a file name or other name for the input
      input - the input being processed
      index - a location in the input where an error occurred
      e - the exception that generated an error
      verbose - true if a long format should be used
      showLocation - true if line number and column numbers should be shown; false otherwise
    • displayConsoleIfNeeded

      void displayConsoleIfNeeded()
      Display a console if there is one, if it is an instance of SimpleConsole, and if there is new text to display. For a SimpleConsole to be available, it must have been passed to setAppendable(Appendable).
    • display

      void display(String prefix, Throwable t)
      Display a Throwable with a prefix. at a minimum, the Throwable's message will be displayed. Optionally, a stack trace may be displayed as well.
      Parameters:
      prefix - a prefix to show before a stack trace, typically consisting of spaces
      t - the Throwable
      See Also:
    • display

      void display(Throwable t)
      Display a Throwable. at a minimum, the Throwable's message will be displayed. Optionally, a stack trace may be displayed as well.
      Parameters:
      t - the Throwable
      See Also:
    • display

      void display(String msg)
      Display a message.
      Parameters:
      msg - the message to display
    • format

      void format(String format, Object... args)
      Display formatted text using the default locale. See Formatter for a description of the format string.
      Parameters:
      format - a format string
      args - the arguments to format
    • format

      void format(Locale locale, String format, Object... args)
      Display formatted text for a specific locale. See Formatter for a description of the format string.
      Parameters:
      locale - the Locale, null for no localization
      format - a format string
      args - the arguments to format
    • displayFormat

      void displayFormat(String title, String format, Object... args)
      Display formatted text with a title using the default locale. The title is used as the title of a dialog box when a dialog box is used to display the message, If setComponent was not called, the title will be ignored and the message will appear on the* Appendable used to log messages. See Formatter for a description of the format string.
      Parameters:
      title - the title; null for the default title
      format - a format string
      args - the arguments to format
    • displayFormat

      void displayFormat(String title, Locale locale, String format, Object... args)
      Display formatted text with a title for a specific locale. The title is used as the title of a dialog box when a dialog box is used to display the message, If no component was specified for centering a dialog box, the title is ignored and the message is printed on an Appendable. See Formatter for a description of the format string.
      Parameters:
      title - the title; null for the default title
      locale - the Locale, null for no localization
      format - a format string
      args - the arguments to format
    • display

      void display(String title, String msg)
      Display a message with a title. The title is used as the title of a dialog box when a dialog box is used to display the message. If setComponent was not called,the title will be ignored and the message will appear on the Appendable used to log messages.
      Parameters:
      msg - the message to display
      title - the title; null for the default title
      See Also: