Class FaultEvent
- All Implemented Interfaces:
StreamEvent
When an error occurs, if the configured ErrorStrategy returns
ErrorStrategy.Action.CONTINUE, EventSource.readAnyEvent() and
EventSource.anyEvents() will return a FaultEvent. Otherwise, the error
would instead be thrown as a StreamException.
If you receive a FaultEvent, the EventSource is now in an inactive state since
either a connection attempt has failed or an existing connection has been closed.
EventSource will attempt to reconnect if you either call EventSource.start()
or simply continue reading events after this point.
- Since:
- 4.0.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionFaultEvent(StreamException cause) Creates an instance.FaultEvent(StreamException cause, ResponseHeaders headers) Creates an instance with response headers. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetCause()Returns aStreamExceptiondescribing the cause of the failure.Returns the response headers if available, or null otherwise.inthashCode()toString()
-
Constructor Details
-
FaultEvent
Creates an instance.- Parameters:
cause- the cause of the failure
-
FaultEvent
Creates an instance with response headers.- Parameters:
cause- the cause of the failureheaders- the response headers if available (typically for HTTP errors), or null- Since:
- 4.2.0
-
-
Method Details
-
getCause
Returns aStreamExceptiondescribing the cause of the failure.- Returns:
- the cause of the failure
-
getHeaders
Returns the response headers if available, or null otherwise.For HTTP error responses (when the cause is a
StreamHttpErrorException), this typically contains the HTTP response headers from the failed request. For other types of failures (I/O errors, timeouts, etc.), this may be null.- Returns:
- the response headers, or null if not available
- Since:
- 4.2.0
-
equals
-
hashCode
public int hashCode() -
toString
-