com.vaadin.hilla.exception.
Class EndpointException
All Implemented Interfaces:
Direct Known Subclasses:
An exception that is intended to be thrown by any Vaadin endpoint method to
propagate exception details to the client side. When an exception is thrown
by an endpoint method, a particular response is constructed based on the data
of the exception and sent to the client side. When a client library receives
the response, it raises the corresponding exception using the response data.
By default, if any Vaadin endpoint method throws an exception when being
invoked by the client request, the exception details are concealed due to
security reasons. When there's a need to pass some information about the
failure on the client side, this exception or any of its subclasses can be
used.
Refer to the getSerializationData()
method to see
the information on the data being sent to the client.
Refer to VaadinConnectException
in the client library for more
information about the client side of the implementation.
See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
A message field to be used in the exception's serialization data in
getSerializationData()
. -
Constructor Summary
ConstructorsConstructorDescriptionEndpointException
(String message) Creates an exception which information is propagated to the client since, if thrown from a Vaadin endpoint method.
EndpointException
(String message, Object detail) Creates an exception which information is propagated to the client since, if thrown from a Vaadin endpoint method.
EndpointException
(String message, Throwable cause) Creates an exception which information is propagated to the client since, if thrown from a Vaadin endpoint method.
EndpointException
(String message, Throwable cause, Object detail) Creates an exception which information is propagated to the client since, if thrown from a Vaadin endpoint method.
EndpointException
(Throwable cause) Creates an exception which information is propagated to the client since, if thrown from a Vaadin endpoint method.
-
Method Summary
Modifier and TypeMethodDescriptionGets the detail of the exception, if provided by user,
null
otherwise.Creates a map with the serialization data to be sent to the client when the exception thrown is processed by
EndpointController
.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
ERROR_MESSAGE_FIELD
A message field to be used in the exception's serialization data in
getSerializationData()
.See Also:
-
-
Constructor Details
-
EndpointException
Creates an exception which information is propagated to the client since, if thrown from a Vaadin endpoint method.
Parameters:
message
- the message to put in the client side exception message when an exception is thrown -
EndpointException
Creates an exception which information is propagated to the client since, if thrown from a Vaadin endpoint method. Will reuse the original exception's message when thrown.
Parameters:
cause
- the original exception that had caused the current one to be thrown -
EndpointException
Creates an exception which information is propagated to the client since, if thrown from a Vaadin endpoint method.
Parameters:
message
- the message to put in the client side exception message when an * exception is throwndetail
- a detail object that will be serialized into JSON and sent to the client, when the exception is thrown -
EndpointException
Creates an exception which information is propagated to the client since, if thrown from a Vaadin endpoint method.
Parameters:
message
- the message to put in the client side exception message when an * * exception is throwncause
- the original exception that had caused the current one to be thrown. -
EndpointException
Creates an exception which information is propagated to the client since, if thrown from a Vaadin endpoint method.
Parameters:
message
- the message to put in the client side exception message when an * * exception is throwncause
- the original exception that had caused the current one to be throwndetail
- a detail object that will be serialized into JSON and sent to the client, when the exception is thrown
-
-
Method Details
-
getDetail
Gets the detail of the exception, if provided by user,
null
otherwise.Returns:
the detail of the exception
-
getSerializationData
Creates a map with the serialization data to be sent to the client when the exception thrown is processed by
EndpointController
. The following data will be sent to the client:- exception type: either the original exception type or
EndpointException
, if no original exception is given - message: non-blank message either from the constructor or from the original exception. If both are blank, none provided.
- detail: detail object serialized to json, if provided in the corresponding constructor
Returns:
the data to be sent to the client
- exception type: either the original exception type or
-