Class FaultEvent

java.lang.Object
com.launchdarkly.eventsource.FaultEvent
All Implemented Interfaces:
StreamEvent

public final class FaultEvent extends Object implements StreamEvent
Describes a failure in the stream.

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 Details

    • FaultEvent

      public FaultEvent(StreamException cause)
      Creates an instance.
      Parameters:
      cause - the cause of the failure
    • FaultEvent

      public FaultEvent(StreamException cause, ResponseHeaders headers)
      Creates an instance with response headers.
      Parameters:
      cause - the cause of the failure
      headers - the response headers if available (typically for HTTP errors), or null
      Since:
      4.2.0
  • Method Details

    • getCause

      public StreamException getCause()
      Returns a StreamException describing the cause of the failure.
      Returns:
      the cause of the failure
    • getHeaders

      public ResponseHeaders 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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object