View Javadoc
1   /*
2    * Copyright 2020 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License,
5    * version 2.0 (the "License"); you may not use this file except in compliance
6    * with the License. You may obtain a copy of the License at:
7    *
8    *   https://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  package io.netty.handler.codec.http3;
17  
18  /**
19   * Different <a href="https://tools.ietf.org/html/draft-ietf-quic-http-32#section-8.1">HTTP3 error codes</a>.
20   */
21  public enum Http3ErrorCode {
22  
23      /**
24       *  No error. This is used when the connection or stream needs to be closed, but there is no error to signal.
25       */
26      H3_NO_ERROR(0x100),
27  
28      /**
29       * Peer violated protocol requirements in a way that does not match a more specific error code,
30       * or endpoint declines to use the more specific error code.
31       */
32      H3_GENERAL_PROTOCOL_ERROR(0x101),
33  
34      /**
35       * An internal error has occurred in the HTTP stack.
36       */
37      H3_INTERNAL_ERROR(0x102),
38  
39      /**
40       * The endpoint detected that its peer created a stream that it will not accept.
41       */
42      H3_STREAM_CREATION_ERROR(0x103),
43  
44      /**
45       * A stream required by the HTTP/3 connection was closed or reset.
46       */
47      H3_CLOSED_CRITICAL_STREAM(0x104),
48  
49      /**
50       * A frame was received that was not permitted in the current state or on the current stream.
51       */
52      H3_FRAME_UNEXPECTED(0x105),
53  
54      /**
55       * A frame that fails to satisfy layout requirements or with an invalid size was received.
56       */
57      H3_FRAME_ERROR(0x106),
58  
59      /**
60       * The endpoint detected that its peer is exhibiting a behavior that might be generating excessive load.
61       */
62      H3_EXCESSIVE_LOAD(0x107),
63  
64      /**
65       * A Stream ID or Push ID was used incorrectly, such as exceeding a limit, reducing a limit, or being reused.
66       */
67      H3_ID_ERROR(0x108),
68  
69      /**
70       * An endpoint detected an error in the payload of a SETTINGS frame.
71       */
72      H3_SETTINGS_ERROR(0x109),
73  
74      /**
75       * No SETTINGS frame was received at the beginning of the control stream.
76       */
77      H3_MISSING_SETTINGS(0x10a),
78  
79      /**
80       * A server rejected a request without performing any application processing.
81       */
82      H3_REQUEST_REJECTED(0x10b),
83  
84      /**
85       * The request or its response (including pushed response) is cancelled.
86       */
87      H3_REQUEST_CANCELLED(0x10c),
88  
89      /**
90       * The client's stream terminated without containing a fully-formed request.
91       */
92      H3_REQUEST_INCOMPLETE(0x10d),
93  
94      /**
95       * An HTTP message was malformed and cannot be processed.
96       */
97      H3_MESSAGE_ERROR(0x10e),
98  
99      /**
100      * The TCP connection established in response to a CONNECT request was reset or abnormally closed.
101      */
102     H3_CONNECT_ERROR(0x10f),
103 
104     /**
105      * The requested operation cannot be served over HTTP/3. The peer should retry over HTTP/1.1.
106      */
107     H3_VERSION_FALLBACK(0x110),
108 
109     /**
110      * The decoder failed to interpret an encoded field section and is not able to continue decoding that field section.
111      */
112     QPACK_DECOMPRESSION_FAILED(0x200),
113 
114     /**
115      * The decoder failed to interpret an encoder instruction received on the encoder stream.
116      */
117     QPACK_ENCODER_STREAM_ERROR(0x201),
118 
119     /**
120      * The encoder failed to interpret a decoder instruction received on the decoder stream.
121      */
122     QPACK_DECODER_STREAM_ERROR(0x202);
123 
124     final int code;
125 
126     Http3ErrorCode(int code) {
127         this.code = code;
128     }
129 
130     public int code() {
131         return code;
132     }
133 }