Package io.netty.handler.codec.http2
Class Http2Exception
java.lang.Object
java.lang.Throwable
java.lang.Exception
io.netty.handler.codec.http2.Http2Exception
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Http2Exception.ClosedStreamCreationException
,Http2Exception.CompositeStreamException
,Http2Exception.StacklessHttp2Exception
,Http2Exception.StreamException
,Http2NoMoreStreamIdsException
,StreamBufferingEncoder.Http2ChannelClosedException
,StreamBufferingEncoder.Http2GoAwayException
Exception thrown when an HTTP/2 error was encountered.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Used when a stream creation attempt fails but may be because the stream was previously closed.static final class
Provides the ability to handle multiple stream exceptions with one throw statement.static final class
static enum
Provides a hint as to if shutdown is justified, what type of shutdown should be executed.private static final class
static class
Represents an exception that can be isolated to a single stream (as opposed to the entire connection). -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Http2Error
private static final long
private final Http2Exception.ShutdownHint
-
Constructor Summary
ConstructorsModifierConstructorDescriptionHttp2Exception
(Http2Error error) Http2Exception
(Http2Error error, Http2Exception.ShutdownHint shutdownHint) Http2Exception
(Http2Error error, String message) Http2Exception
(Http2Error error, String message, Http2Exception.ShutdownHint shutdownHint) private
Http2Exception
(Http2Error error, String message, Http2Exception.ShutdownHint shutdownHint, boolean shared) Http2Exception
(Http2Error error, String message, Throwable cause) Http2Exception
(Http2Error error, String message, Throwable cause, Http2Exception.ShutdownHint shutdownHint) -
Method Summary
Modifier and TypeMethodDescriptionstatic Http2Exception
closedStreamError
(Http2Error error, String fmt, Object... args) Use if an error has occurred which can not be isolated to a single stream, but instead applies to the entire connection.static Http2Exception
connectionError
(Http2Error error, String fmt, Object... args) Use if an error has occurred which can not be isolated to a single stream, but instead applies to the entire connection.static Http2Exception
connectionError
(Http2Error error, Throwable cause, String fmt, Object... args) Use if an error has occurred which can not be isolated to a single stream, but instead applies to the entire connection.error()
private static String
formatErrorMessage
(String fmt, Object[] args) static Http2Exception
headerListSizeError
(int id, Http2Error error, boolean onDecode, String fmt, Object... args) A specific stream error resulting from failing to decode headers that exceeds the max header size list.static boolean
Check if an exception is isolated to a single stream or the entire connection.(package private) static Http2Exception
newStatic
(Http2Error error, String message, Http2Exception.ShutdownHint shutdownHint, Class<?> clazz, String method) Provide a hint as to what type of shutdown should be executed.static Http2Exception
streamError
(int id, Http2Error error, String fmt, Object... args) Use if an error which can be isolated to a single stream has occurred.static Http2Exception
streamError
(int id, Http2Error error, Throwable cause, String fmt, Object... args) Use if an error which can be isolated to a single stream has occurred.static int
Get the stream id associated with an exception.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
error
-
shutdownHint
-
-
Constructor Details
-
Http2Exception
-
Http2Exception
-
Http2Exception
-
Http2Exception
-
Http2Exception
-
Http2Exception
public Http2Exception(Http2Error error, String message, Throwable cause, Http2Exception.ShutdownHint shutdownHint) -
Http2Exception
private Http2Exception(Http2Error error, String message, Http2Exception.ShutdownHint shutdownHint, boolean shared)
-
-
Method Details
-
newStatic
static Http2Exception newStatic(Http2Error error, String message, Http2Exception.ShutdownHint shutdownHint, Class<?> clazz, String method) -
error
-
shutdownHint
Provide a hint as to what type of shutdown should be executed. Note this hint may be ignored. -
connectionError
Use if an error has occurred which can not be isolated to a single stream, but instead applies to the entire connection.- Parameters:
error
- The type of error as defined by the HTTP/2 specification.fmt
- String with the content and format for the additional debug data.args
- Objects which fit into the format defined byfmt
.- Returns:
- An exception which can be translated into an HTTP/2 error.
-
connectionError
public static Http2Exception connectionError(Http2Error error, Throwable cause, String fmt, Object... args) Use if an error has occurred which can not be isolated to a single stream, but instead applies to the entire connection.- Parameters:
error
- The type of error as defined by the HTTP/2 specification.cause
- The object which caused the error.fmt
- String with the content and format for the additional debug data.args
- Objects which fit into the format defined byfmt
.- Returns:
- An exception which can be translated into an HTTP/2 error.
-
closedStreamError
Use if an error has occurred which can not be isolated to a single stream, but instead applies to the entire connection.- Parameters:
error
- The type of error as defined by the HTTP/2 specification.fmt
- String with the content and format for the additional debug data.args
- Objects which fit into the format defined byfmt
.- Returns:
- An exception which can be translated into an HTTP/2 error.
-
streamError
Use if an error which can be isolated to a single stream has occurred. If theid
is notHttp2CodecUtil.CONNECTION_STREAM_ID
then aHttp2Exception.StreamException
will be returned. Otherwise the error is considered a connection error and aHttp2Exception
is returned.- Parameters:
id
- The stream id for which the error is isolated to.error
- The type of error as defined by the HTTP/2 specification.fmt
- String with the content and format for the additional debug data.args
- Objects which fit into the format defined byfmt
.- Returns:
- If the
id
is notHttp2CodecUtil.CONNECTION_STREAM_ID
then aHttp2Exception.StreamException
will be returned. Otherwise the error is considered a connection error and aHttp2Exception
is returned.
-
streamError
public static Http2Exception streamError(int id, Http2Error error, Throwable cause, String fmt, Object... args) Use if an error which can be isolated to a single stream has occurred. If theid
is notHttp2CodecUtil.CONNECTION_STREAM_ID
then aHttp2Exception.StreamException
will be returned. Otherwise the error is considered a connection error and aHttp2Exception
is returned.- Parameters:
id
- The stream id for which the error is isolated to.error
- The type of error as defined by the HTTP/2 specification.cause
- The object which caused the error.fmt
- String with the content and format for the additional debug data.args
- Objects which fit into the format defined byfmt
.- Returns:
- If the
id
is notHttp2CodecUtil.CONNECTION_STREAM_ID
then aHttp2Exception.StreamException
will be returned. Otherwise the error is considered a connection error and aHttp2Exception
is returned.
-
headerListSizeError
public static Http2Exception headerListSizeError(int id, Http2Error error, boolean onDecode, String fmt, Object... args) A specific stream error resulting from failing to decode headers that exceeds the max header size list. If theid
is notHttp2CodecUtil.CONNECTION_STREAM_ID
then aHttp2Exception.StreamException
will be returned. Otherwise the error is considered a connection error and aHttp2Exception
is returned.- Parameters:
id
- The stream id for which the error is isolated to.error
- The type of error as defined by the HTTP/2 specification.onDecode
- Whether this error was caught while decoding headersfmt
- String with the content and format for the additional debug data.args
- Objects which fit into the format defined byfmt
.- Returns:
- If the
id
is notHttp2CodecUtil.CONNECTION_STREAM_ID
then aHttp2Exception.HeaderListSizeException
will be returned. Otherwise the error is considered a connection error and aHttp2Exception
is returned.
-
formatErrorMessage
-
isStreamError
Check if an exception is isolated to a single stream or the entire connection.- Parameters:
e
- The exception to check.- Returns:
true
ife
is an instance ofHttp2Exception.StreamException
.false
otherwise.
-
streamId
Get the stream id associated with an exception.- Parameters:
e
- The exception to get the stream id for.- Returns:
Http2CodecUtil.CONNECTION_STREAM_ID
ife
is a connection error. Otherwise the stream id associated with the stream error.
-