Class FormException

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    FormFieldException

    @NotThreadSafe
    public class FormException
    extends java.lang.RuntimeException
    Exception thrown when a form is invalid. Problems with a specific form field should use FormFieldException instead.

    You can safely throw FormException from within your form validator, and the message will automatically be propagated to the client form interface.

    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getMessage()
      Returns an error message that's safe to display to the user.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

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

      • FormException

        public FormException​(@Detainted
                             java.lang.String userMessage)
        Creates a new FormException
        Parameters:
        userMessage - should be a friendly message that's safe to show to the user.
      • FormException

        public FormException​(@Detainted
                             java.lang.String userMessage,
                             java.lang.Throwable cause)
        Creates a new FormException
        Parameters:
        userMessage - should be a friendly message that's safe to show to the user.
        cause - the original cause of this exception. May be null.
    • Method Detail

      • getMessage

        @Detainted
        public java.lang.String getMessage()
        Returns an error message that's safe to display to the user.
        Overrides:
        getMessage in class java.lang.Throwable