status-go/vendor/github.com/pion/stun/attributes_debug.go

38 lines
722 B
Go
Raw Normal View History

2024-05-15 23:15:00 +00:00
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
// SPDX-License-Identifier: MIT
//go:build debug
2022-03-10 09:44:48 +00:00
// +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,
)
}