Package com.vaadin.flow.router
Class ErrorParameter<T extends Exception>
java.lang.Object
com.vaadin.flow.router.ErrorParameter<T>
- Type Parameters:
T
- the type of the error parameter
- All Implemented Interfaces:
Serializable
Navigation error parameter class containing thrown exception and possibly a
custom message.
- Since:
- 1.0.
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
ConstructorDescriptionErrorParameter
(Class<T> parameterType, Exception caughtException) Create ErrorParameter for exception.ErrorParameter
(Class<T> parameterType, Exception caughtException, String customMessage) Create ErrorParameter for exception with a custom message. -
Method Summary
Modifier and TypeMethodDescriptionGets the originally caught exception.Get the set custom message.Get the error parameter exception.boolean
Check if we have a custom message for the exception.
-
Constructor Details
-
ErrorParameter
Create ErrorParameter for exception.- Parameters:
parameterType
- the exception type of this error parametercaughtException
- the caught exception
-
ErrorParameter
Create ErrorParameter for exception with a custom message.- Parameters:
parameterType
- the exception type of this error parametercaughtException
- the caught exceptioncustomMessage
- custom message to go with exception
-
-
Method Details
-
getException
Get the error parameter exception. This will be the same asgetCaughtException()
if that exception is of the type of this error parameter. Otherwise, it will be the firstThrowable.getCause()
which is of the right type.- Returns:
- exception
- See Also:
-
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:
-
hasCustomMessage
public boolean hasCustomMessage()Check if we have a custom message for the exception.- Returns:
- true if a custom message is set
-
getCustomMessage
Get the set custom message.- Returns:
- custom message or empty if not defined
-