Class Http3Exception

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
FieldSectionSizeException

public class Http3Exception extends IOException
A violation of HTTP/3 or QPACK by the peer (or a limit it exceeded), with the error code to send back and the scope of the error (RFC 9114 §8).
  • A connection error (isConnectionError()) leaves the connection unusable: close it with errorCode() (a QUIC CONNECTION_CLOSE, after a GOAWAY if possible). The reader, encoder or decoder that threw it must not be used again.
  • A stream error affects only streamId(): reset the stream and stop reading it with errorCode(), and carry on with the connection.

QUIC stream IDs start at 0, so a connection error has a streamId() of -1. Any stream error may be treated as a connection error by a caller that prefers to.

See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • connectionError

      public static Http3Exception connectionError(Http3ErrorCode errorCode, String message)
      An error that ends the connection.
      Parameters:
      errorCode - the code to close the connection with
      message - what went wrong
      Returns:
      the exception
    • streamError

      public static Http3Exception streamError(long streamId, Http3ErrorCode errorCode, String message)
      An error that ends only the given stream.
      Parameters:
      streamId - the stream, 0 to 2^62-1
      errorCode - the code to reset the stream with
      message - what went wrong
      Returns:
      the exception
    • errorCode

      public Http3ErrorCode errorCode()
      The code to close the connection (connection error) or reset the stream (stream error) with.
      Returns:
      the error code
    • streamId

      public long streamId()
      The stream in error, or NO_STREAM for a connection error.
      Returns:
      the stream id, or -1
    • isConnectionError

      public boolean isConnectionError()
      Whether the error ends the connection rather than one stream.
      Returns:
      whether this is a connection error
    • getMessage

      public String getMessage()
      Overrides:
      getMessage in class Throwable