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 parameterAll Implemented Interfaces:
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:
-
-
Constructor Summary
Constructors Constructor Description ErrorParameter(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
All Methods Modifier and Type Method Description Exception
getCaughtException()
Gets the originally caught exception.
String
getCustomMessage()
Get the set custom message.
T
getException()
Get the error parameter exception.
boolean
hasCustomMessage()
Check if we have a custom message for the exception.
-
-
-
Constructor Detail
-
ErrorParameter
public ErrorParameter(Class<T> parameterType, Exception caughtException)
Create ErrorParameter for exception.
Parameters:
parameterType
- the exception type of this error parametercaughtException
- 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 parametercaughtException
- the caught exceptioncustomMessage
- 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 firstThrowable.getCause()
which is of the right type.Returns:
exception
See Also:
-
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:
-
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
-
-