(self)
| 98 | RESPONSE_VALIDATION_FAILED = 13 |
| 99 | |
| 100 | def http_status_code(self) -> int | None: |
| 101 | match self: |
| 102 | # Client Errors |
| 103 | case ( |
| 104 | ErrorCode.GENERIC_CLIENT_ERROR |
| 105 | | ErrorCode.REQUEST_VALIDATION_FAILED |
| 106 | | ErrorCode.DESTINATION_UNKNOWN |
| 107 | ): |
| 108 | return status_codes.BAD_REQUEST |
| 109 | case ErrorCode.REQUEST_TOO_LARGE: |
| 110 | return status_codes.PAYLOAD_TOO_LARGE |
| 111 | case ( |
| 112 | ErrorCode.CONNECT_FAILED |
| 113 | | ErrorCode.GENERIC_SERVER_ERROR |
| 114 | | ErrorCode.RESPONSE_VALIDATION_FAILED |
| 115 | | ErrorCode.RESPONSE_TOO_LARGE |
| 116 | ): |
| 117 | return status_codes.BAD_GATEWAY |
| 118 | case ( |
| 119 | ErrorCode.PASSTHROUGH_CLOSE |
| 120 | | ErrorCode.KILL |
| 121 | | ErrorCode.HTTP_1_1_REQUIRED |
| 122 | | ErrorCode.CLIENT_DISCONNECTED |
| 123 | | ErrorCode.CANCEL |
| 124 | ): |
| 125 | return None |
| 126 | case other: # pragma: no cover |
| 127 | typing.assert_never(other) |
| 128 | |
| 129 | |
| 130 | @dataclass |
no outgoing calls
no test coverage detected