Package io.github.mahmoudimus.http3
Class Http3Exception
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
io.github.mahmoudimus.http3.Http3Exception
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
FieldSectionSizeException
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 witherrorCode()(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 witherrorCode(), 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 Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHttp3Exception(Http3ErrorCode errorCode, long streamId, String message) Creates an error;connectionError(io.github.mahmoudimus.http3.Http3ErrorCode, java.lang.String)andstreamError(long, io.github.mahmoudimus.http3.Http3ErrorCode, java.lang.String)are the usual way. -
Method Summary
Modifier and TypeMethodDescriptionstatic Http3ExceptionconnectionError(Http3ErrorCode errorCode, String message) An error that ends the connection.The code to close the connection (connection error) or reset the stream (stream error) with.booleanWhether the error ends the connection rather than one stream.static Http3ExceptionstreamError(long streamId, Http3ErrorCode errorCode, String message) An error that ends only the given stream.longstreamId()The stream in error, orNO_STREAMfor a connection error.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
NO_STREAM
public static final long NO_STREAMThestreamId()of a connection error.- See Also:
-
-
Constructor Details
-
Http3Exception
Creates an error;connectionError(io.github.mahmoudimus.http3.Http3ErrorCode, java.lang.String)andstreamError(long, io.github.mahmoudimus.http3.Http3ErrorCode, java.lang.String)are the usual way.- Parameters:
errorCode- the code to sendstreamId- the stream in error, orNO_STREAMfor a connection errormessage- what went wrong
-
-
Method Details
-
connectionError
An error that ends the connection.- Parameters:
errorCode- the code to close the connection withmessage- what went wrong- Returns:
- the exception
-
streamError
An error that ends only the given stream.- Parameters:
streamId- the stream, 0 to 2^62-1errorCode- the code to reset the stream withmessage- what went wrong- Returns:
- the exception
-
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, orNO_STREAMfor 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
- Overrides:
getMessagein classThrowable
-