Class AnchorFriendlyRuntimeException

All Implemented Interfaces:
Serializable, HasFriendlyErrorMessage
Direct Known Subclasses:
AnchorImpossibleSituationException, BeanDuplicateException, BeanStrangeException, CheckedStream.ConvertedToRuntimeException, CommandLineException, IncorrectVoxelTypeException, OutputDirectoryAlreadyExistsException

public class AnchorFriendlyRuntimeException extends AnchorRuntimeException implements HasFriendlyErrorMessage
A base class for particular runtime-exceptions which are guaranteed to provide a user-friendly error description.

See the counterpart AnchorFriendlyCheckedException.

Author:
Owen Feehan
See Also:
  • Constructor Details

    • AnchorFriendlyRuntimeException

      public AnchorFriendlyRuntimeException(String message, Throwable cause)
      A user-friendly error message and its cause. The message is displayed to the user.
      Parameters:
      message - a user-friendly error message to display to the user indicating the problem.
      cause - the cause of the error.
    • AnchorFriendlyRuntimeException

      public AnchorFriendlyRuntimeException(String message)
      A user-friendly error message without a cause. This exception is displayed to the user. There are no more nested-errors possible.
      Parameters:
      message - cause the cause of the error.
    • AnchorFriendlyRuntimeException

      public AnchorFriendlyRuntimeException(Throwable cause)
      A wrapped exception. We skip it in error reports.
      Parameters:
      cause - the cause of the error.
  • Method Details

    • friendlyMessage

      public String friendlyMessage()
      Description copied from interface: HasFriendlyErrorMessage
      A friendly message to describe to the user what went wrong. If no message has been defined in this exception, we keep iterating the hierarchy until we find a message
      Specified by:
      friendlyMessage in interface HasFriendlyErrorMessage
      Returns:
      a string describing what went wrong
    • friendlyMessageHierarchy

      public String friendlyMessageHierarchy()
      Description copied from interface: HasFriendlyErrorMessage
      A friendly message to describe to the user what went wrong, which doesn't impose a fixed-size, or showExceptionNames
      Specified by:
      friendlyMessageHierarchy in interface HasFriendlyErrorMessage
      Returns:
      a string (often multi-lined) describing a hierarchy of errors that occurred
    • friendlyMessageHierarchy

      public void friendlyMessageHierarchy(Writer writer, int wordWrapLimit, boolean showExceptionNames) throws IOException
      Description copied from interface: HasFriendlyErrorMessage
      A friendly message to describe to the user what went wrong, including all nested exceptions that have a non-empty error message

      It starts the least-most-nested exception. It ends with the further-most-nested exception (cause).

      Specified by:
      friendlyMessageHierarchy in interface HasFriendlyErrorMessage
      Parameters:
      writer - where the friendly-messaged is outputted
      wordWrapLimit - a fixed-width size for the message and indentation (ignoring the exception name). -1 disables.
      showExceptionNames - show exception-names after the error output
      Throws:
      IOException - if an I/O error occurs with the writer