Class ErrorParameter<T extends Exception>

  • Type Parameters:
    T - the type of the error parameter
    All Implemented Interfaces:
    Serializable

    public class ErrorParameter<T extends Exception>
    extends Object
    implements Serializable
    Navigation error parameter class containing thrown exception and possibly a custom message.
    Since:
    1.0.
    Author:
    Vaadin Ltd
    See Also:
    Serialized Form
    • Constructor Detail

      • ErrorParameter

        public ErrorParameter​(Class<T> parameterType,
                              Exception caughtException)
        Create ErrorParameter for exception.
        Parameters:
        parameterType - the exception type of this error parameter
        caughtException - the caught exception
      • ErrorParameter

        public ErrorParameter​(Class<T> parameterType,
                              Exception caughtException,
                              String customMessage)
        Create ErrorParameter for exception with a custom message.
        Parameters:
        parameterType - the exception type of this error parameter
        caughtException - the caught exception
        customMessage - custom message to go with exception
    • Method Detail

      • getException

        public T getException()
        Get the error parameter exception. This will be the same as getCaughtException() if that exception is of the type of this error parameter. Otherwise, it will be the first Throwable.getCause() which is of the right type.
        Returns:
        exception
        See Also:
        getCaughtException()
      • getCaughtException

        public Exception getCaughtException()
        Gets the originally caught exception. This exception might not match the type of this error parameter if it has been created based on an exception that is the cause of the caught exception.
        Returns:
        the caught exception
        See Also:
        getException()
      • hasCustomMessage

        public boolean hasCustomMessage()
        Check if we have a custom message for the exception.
        Returns:
        true if a custom message is set
      • getCustomMessage

        public String getCustomMessage()
        Get the set custom message.
        Returns:
        custom message or empty if not defined