update HTTP/3 errors

This commit is contained in:
Marten Seemann
2019-09-04 12:02:04 +07:00
parent d689f9a392
commit f9bbac8b04
5 changed files with 54 additions and 73 deletions

View File

@@ -9,80 +9,65 @@ import (
type errorCode quic.ErrorCode
const (
errorNoError errorCode = 0x0
errorWrongSettingsDirection errorCode = 0x1
errorPushRefused errorCode = 0x2
errorInternalError errorCode = 0x3
errorPushAlreadyInCache errorCode = 0x4
errorRequestCanceled errorCode = 0x5
errorIncompleteRequest errorCode = 0x6
errorConnectError errorCode = 0x7
errorExcessiveLoad errorCode = 0x8
errorVersionFallback errorCode = 0x9
errorWrongStream errorCode = 0xa
errorLimitExceeded errorCode = 0xb
errorDuplicatePush errorCode = 0xc
errorUnknownStreamType errorCode = 0xd
errorWrongStreamCount errorCode = 0xe
errorClosedCriticalStream errorCode = 0xf
errorWrongStreamDirection errorCode = 0x10
errorEarlyResponse errorCode = 0x11
errorMissingSettings errorCode = 0x12
errorUnexpectedFrame errorCode = 0x13
errorRequestRejected errorCode = 0x14
errorGeneralProtocolError errorCode = 0xff
errorNoError errorCode = 0x100
errorGeneralProtocolError errorCode = 0x101
errorInternalError errorCode = 0x102
errorStreamCreationError errorCode = 0x103
errorClosedCriticalStream errorCode = 0x104
errorUnexpectedFrame errorCode = 0x105
errorFrameError errorCode = 0x106
errorExcessiveLoad errorCode = 0x107
errorWrongStream errorCode = 0x108
errorIDError errorCode = 0x109
errorSettingsError errorCode = 0x10a
errorMissingSettings errorCode = 0x10b
errorRequestRejected errorCode = 0x10c
errorRequestCanceled errorCode = 0x10d
errorRequestIncomplete errorCode = 0x10e
errorEarlyResponse errorCode = 0x10f
errorConnectError errorCode = 0x110
errorVersionFallback errorCode = 0x111
)
func (e errorCode) String() string {
switch e {
case errorNoError:
return "HTTP_NO_ERROR"
case errorWrongSettingsDirection:
return "HTTP_WRONG_SETTING_DIRECTION"
case errorPushRefused:
return "HTTP_PUSH_REFUSED"
case errorInternalError:
return "HTTP_INTERNAL_ERROR"
case errorPushAlreadyInCache:
return "HTTP_PUSH_ALREADY_IN_CACHE"
case errorRequestCanceled:
return "HTTP_REQUEST_CANCELLED"
case errorIncompleteRequest:
return "HTTP_INCOMPLETE_REQUEST"
case errorConnectError:
return "HTTP_CONNECT_ERROR"
case errorExcessiveLoad:
return "HTTP_EXCESSIVE_LOAD"
case errorVersionFallback:
return "HTTP_VERSION_FALLBACK"
case errorWrongStream:
return "HTTP_WRONG_STREAM"
case errorLimitExceeded:
return "HTTP_LIMIT_EXCEEDED"
case errorDuplicatePush:
return "HTTP_DUPLICATE_PUSH"
case errorUnknownStreamType:
return "HTTP_UNKNOWN_STREAM_TYPE"
case errorWrongStreamCount:
return "HTTP_WRONG_STREAM_COUNT"
case errorClosedCriticalStream:
return "HTTP_CLOSED_CRITICAL_STREAM"
case errorWrongStreamDirection:
return "HTTP_WRONG_STREAM_DIRECTION"
case errorEarlyResponse:
return "HTTP_EARLY_RESPONSE"
case errorMissingSettings:
return "HTTP_MISSING_SETTINGS"
case errorUnexpectedFrame:
return "HTTP_UNEXPECTED_FRAME"
case errorRequestRejected:
return "HTTP_REQUEST_REJECTED"
case errorGeneralProtocolError:
return "HTTP_GENERAL_PROTOCOL_ERROR"
case errorInternalError:
return "HTTP_INTERNAL_ERROR"
case errorStreamCreationError:
return "HTTP_STREAM_CREATION_ERROR"
case errorClosedCriticalStream:
return "HTTP_CLOSED_CRITICAL_STREAM"
case errorUnexpectedFrame:
return "HTTP_UNEXPECTED_FRAME"
case errorFrameError:
return "HTTP_FRAME_ERROR"
case errorExcessiveLoad:
return "HTTP_EXCESSIVE_LOAD"
case errorWrongStream:
return "HTTP_WRONG_STREAM"
case errorIDError:
return "HTTP_ID_ERROR"
case errorSettingsError:
return "HTTP_SETTINGS_ERROR"
case errorMissingSettings:
return "HTTP_MISSING_SETTINGS"
case errorRequestRejected:
return "HTTP_REQUEST_REJECTED"
case errorRequestCanceled:
return "HTTP_REQUEST_CANCELLED"
case errorRequestIncomplete:
return "HTTP_INCOMPLETE_REQUEST"
case errorEarlyResponse:
return "HTTP_EARLY_RESPONSE"
case errorConnectError:
return "HTTP_CONNECT_ERROR"
case errorVersionFallback:
return "HTTP_VERSION_FALLBACK"
default:
if e >= 0x100 && e < 0x200 {
return fmt.Sprintf("HTTP_MALFORMED_FRAME: %#x", uint16(e-0x100))
}
return fmt.Sprintf("unknown error code: %#x", uint16(e))
}
}