File: error_codes.go

package info (click to toggle)
golang-github-lucas-clemente-quic-go 0.54.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,312 kB
  • sloc: sh: 54; makefile: 7
file content (81 lines) | stat: -rw-r--r-- 2,204 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package http3

import (
	"fmt"

	"github.com/quic-go/quic-go"
)

type ErrCode quic.ApplicationErrorCode

const (
	ErrCodeNoError              ErrCode = 0x100
	ErrCodeGeneralProtocolError ErrCode = 0x101
	ErrCodeInternalError        ErrCode = 0x102
	ErrCodeStreamCreationError  ErrCode = 0x103
	ErrCodeClosedCriticalStream ErrCode = 0x104
	ErrCodeFrameUnexpected      ErrCode = 0x105
	ErrCodeFrameError           ErrCode = 0x106
	ErrCodeExcessiveLoad        ErrCode = 0x107
	ErrCodeIDError              ErrCode = 0x108
	ErrCodeSettingsError        ErrCode = 0x109
	ErrCodeMissingSettings      ErrCode = 0x10a
	ErrCodeRequestRejected      ErrCode = 0x10b
	ErrCodeRequestCanceled      ErrCode = 0x10c
	ErrCodeRequestIncomplete    ErrCode = 0x10d
	ErrCodeMessageError         ErrCode = 0x10e
	ErrCodeConnectError         ErrCode = 0x10f
	ErrCodeVersionFallback      ErrCode = 0x110
	ErrCodeDatagramError        ErrCode = 0x33
)

func (e ErrCode) String() string {
	s := e.string()
	if s != "" {
		return s
	}
	return fmt.Sprintf("unknown error code: %#x", uint16(e))
}

func (e ErrCode) string() string {
	switch e {
	case ErrCodeNoError:
		return "H3_NO_ERROR"
	case ErrCodeGeneralProtocolError:
		return "H3_GENERAL_PROTOCOL_ERROR"
	case ErrCodeInternalError:
		return "H3_INTERNAL_ERROR"
	case ErrCodeStreamCreationError:
		return "H3_STREAM_CREATION_ERROR"
	case ErrCodeClosedCriticalStream:
		return "H3_CLOSED_CRITICAL_STREAM"
	case ErrCodeFrameUnexpected:
		return "H3_FRAME_UNEXPECTED"
	case ErrCodeFrameError:
		return "H3_FRAME_ERROR"
	case ErrCodeExcessiveLoad:
		return "H3_EXCESSIVE_LOAD"
	case ErrCodeIDError:
		return "H3_ID_ERROR"
	case ErrCodeSettingsError:
		return "H3_SETTINGS_ERROR"
	case ErrCodeMissingSettings:
		return "H3_MISSING_SETTINGS"
	case ErrCodeRequestRejected:
		return "H3_REQUEST_REJECTED"
	case ErrCodeRequestCanceled:
		return "H3_REQUEST_CANCELLED"
	case ErrCodeRequestIncomplete:
		return "H3_INCOMPLETE_REQUEST"
	case ErrCodeMessageError:
		return "H3_MESSAGE_ERROR"
	case ErrCodeConnectError:
		return "H3_CONNECT_ERROR"
	case ErrCodeVersionFallback:
		return "H3_VERSION_FALLBACK"
	case ErrCodeDatagramError:
		return "H3_DATAGRAM_ERROR"
	default:
		return ""
	}
}