-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy patherrors.go
48 lines (38 loc) · 1 KB
/
errors.go
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
package moqtransport
import "fmt"
const (
ErrorCodeNoError = 0x00
ErrorCodeInternal = 0x01
ErrorCodeUnauthorized = 0x02
ErrorCodeProtocolViolation = 0x03
ErrorCodeDuplicateTrackAlias = 0x04
ErrorCodeParameterLengthMismatch = 0x05
ErrorCodeGoAwayTimeout = 0x10
// Errors not included in current draft
ErrorCodeUnsupportedVersion = 0xff01
ErrorCodeTrackNotFound = 0xff02
)
const (
SubscribeErrorInternal = 0x00
SubscribeErrorInvalidRange = 0x01
SubscribeErrorRetryTrackAlias = 0x02
// TODO: These are not specified yet, but seem useful
SubscribeErrorUnknownTrack = 0x03
)
type ProtocolError struct {
code uint64
message string
}
func (e ProtocolError) Error() string {
return e.message
}
func (e ProtocolError) Code() uint64 {
return e.code
}
type ApplicationError struct {
code uint64
mesage string
}
func (e ApplicationError) Error() string {
return fmt.Sprintf("MoQ Application Error %v: %v", e.code, e.mesage)
}