summaryrefslogtreecommitdiff
path: root/vendor/github.com/pion/stun/attributes_debug.go
blob: 7bf09af7cbb6ab15aea625b2594e4f71add657a2 (plain)
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
// +build debug

package stun

import "fmt"

// AttrOverflowErr occurs when len(v) > Max.
type AttrOverflowErr struct {
	Type AttrType
	Max  int
	Got  int
}

func (e AttrOverflowErr) Error() string {
	return fmt.Sprintf("incorrect length of %s attribute: %d exceeds maximum %d",
		e.Type, e.Got, e.Max,
	)
}

// AttrLengthErr means that length for attribute is invalid.
type AttrLengthErr struct {
	Attr     AttrType
	Got      int
	Expected int
}

func (e AttrLengthErr) Error() string {
	return fmt.Sprintf("incorrect length of %s attribute: got %d, expected %d",
		e.Attr,
		e.Got,
		e.Expected,
	)
}