1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.eclipse.jetty.http2;
20
21 import java.util.HashMap;
22 import java.util.Map;
23
24 public enum ErrorCode
25 {
26 NO_ERROR(0),
27 PROTOCOL_ERROR(1),
28 INTERNAL_ERROR(2),
29 FLOW_CONTROL_ERROR(3),
30 SETTINGS_TIMEOUT_ERROR(4),
31 STREAM_CLOSED_ERROR(5),
32 FRAME_SIZE_ERROR(6),
33 REFUSED_STREAM_ERROR(7),
34 CANCEL_STREAM_ERROR(8),
35 COMPRESSION_ERROR(9),
36 HTTP_CONNECT_ERROR(10),
37 ENHANCE_YOUR_CALM_ERROR(11),
38 INADEQUATE_SECURITY_ERROR(12),
39 HTTP_1_1_REQUIRED_ERROR(13);
40
41 public final int code;
42
43 private ErrorCode(int code)
44 {
45 this.code = code;
46 Codes.codes.put(code, this);
47 }
48
49 public static ErrorCode from(int error)
50 {
51 return Codes.codes.get(error);
52 }
53
54 private static class Codes
55 {
56 private static final Map<Integer, ErrorCode> codes = new HashMap<>();
57 }
58 }