|
18 | 18 | /// terminating streams, aborting reading of streams, or immediately closing |
19 | 19 | /// connections. See RFC 9114 § 8.1. |
20 | 20 | /// |
21 | | -/// This is modeled as a struct rather than an enum so that codes registered by |
22 | | -/// future revisions or extensions can be added without a source-breaking |
23 | | -/// change, and so that a code received from a peer is preserved verbatim even |
24 | | -/// when this library does not recognize it (mirroring `HTTP2ErrorCode`). |
| 21 | +/// This is modeled as a struct rather than an enum so that a code received from |
| 22 | +/// a peer is preserved verbatim even when this library does not recognize it |
| 23 | +/// (mirroring `HTTP2ErrorCode`). |
25 | 24 | public struct HTTP3ErrorCode: Hashable, Sendable { |
26 | 25 | /// The underlying error code value (RFC 9114 § 8.1 / RFC 9000 § 20.2). |
27 | 26 | public var rawValue: UInt64 |
@@ -76,31 +75,31 @@ public struct HTTP3ErrorCode: Hashable, Sendable { |
76 | 75 | public static let qpackDecoderStreamError = HTTP3ErrorCode(rawValue: 0x0202) |
77 | 76 | } |
78 | 77 |
|
79 | | -extension HTTP3ErrorCode: CustomStringConvertible { |
80 | | - public var description: String { |
| 78 | +extension HTTP3ErrorCode: CustomDebugStringConvertible { |
| 79 | + public var debugDescription: String { |
81 | 80 | let name: String |
82 | 81 | switch self { |
83 | | - case .noError: name = "H3_NO_ERROR" |
84 | | - case .generalProtocolError: name = "H3_GENERAL_PROTOCOL_ERROR" |
85 | | - case .internalError: name = "H3_INTERNAL_ERROR" |
86 | | - case .streamCreationError: name = "H3_STREAM_CREATION_ERROR" |
87 | | - case .closedCriticalStream: name = "H3_CLOSED_CRITICAL_STREAM" |
88 | | - case .frameUnexpected: name = "H3_FRAME_UNEXPECTED" |
89 | | - case .frameError: name = "H3_FRAME_ERROR" |
90 | | - case .excessiveLoad: name = "H3_EXCESSIVE_LOAD" |
91 | | - case .idError: name = "H3_ID_ERROR" |
92 | | - case .settingsError: name = "H3_SETTINGS_ERROR" |
93 | | - case .missingSettings: name = "H3_MISSING_SETTINGS" |
94 | | - case .requestRejected: name = "H3_REQUEST_REJECTED" |
95 | | - case .requestCancelled: name = "H3_REQUEST_CANCELLED" |
96 | | - case .requestIncomplete: name = "H3_REQUEST_INCOMPLETE" |
97 | | - case .messageError: name = "H3_MESSAGE_ERROR" |
98 | | - case .connectError: name = "H3_CONNECT_ERROR" |
99 | | - case .versionFallback: name = "H3_VERSION_FALLBACK" |
100 | | - case .qpackDecompressionFailed: name = "QPACK_DECOMPRESSION_FAILED" |
101 | | - case .qpackEncoderStreamError: name = "QPACK_ENCODER_STREAM_ERROR" |
102 | | - case .qpackDecoderStreamError: name = "QPACK_DECODER_STREAM_ERROR" |
103 | | - default: name = "UNKNOWN" |
| 82 | + case .noError: name = "No Error" |
| 83 | + case .generalProtocolError: name = "General Protocol Error" |
| 84 | + case .internalError: name = "Internal Error" |
| 85 | + case .streamCreationError: name = "Stream Creation Error" |
| 86 | + case .closedCriticalStream: name = "Closed Critical Stream" |
| 87 | + case .frameUnexpected: name = "Frame Unexpected" |
| 88 | + case .frameError: name = "Frame Error" |
| 89 | + case .excessiveLoad: name = "Excessive Load" |
| 90 | + case .idError: name = "ID Error" |
| 91 | + case .settingsError: name = "Settings Error" |
| 92 | + case .missingSettings: name = "Missing Settings" |
| 93 | + case .requestRejected: name = "Request Rejected" |
| 94 | + case .requestCancelled: name = "Request Cancelled" |
| 95 | + case .requestIncomplete: name = "Request Incomplete" |
| 96 | + case .messageError: name = "Message Error" |
| 97 | + case .connectError: name = "Connect Error" |
| 98 | + case .versionFallback: name = "Version Fallback" |
| 99 | + case .qpackDecompressionFailed: name = "QPACK Decompression Failed" |
| 100 | + case .qpackEncoderStreamError: name = "QPACK Encoder Stream Error" |
| 101 | + case .qpackDecoderStreamError: name = "QPACK Decoder Stream Error" |
| 102 | + default: name = "Unknown Error" |
104 | 103 | } |
105 | 104 | return "HTTP3ErrorCode<0x\(String(self.rawValue, radix: 16)) \(name)>" |
106 | 105 | } |
|
0 commit comments