You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
604 B
28 lines
604 B
3 years ago
|
package bin
|
||
|
|
||
|
import "fmt"
|
||
|
|
||
|
// InvalidLengthError is returned when decoder reads invalid length.
|
||
|
type InvalidLengthError struct {
|
||
|
Length int
|
||
|
Where string
|
||
|
}
|
||
|
|
||
|
func (i *InvalidLengthError) Error() string {
|
||
|
return fmt.Sprintf("invalid %s length: %d", i.Where, i.Length)
|
||
|
}
|
||
|
|
||
|
// UnexpectedIDErr means that unknown or unexpected type id was decoded.
|
||
|
type UnexpectedIDErr struct {
|
||
|
ID uint32
|
||
|
}
|
||
|
|
||
|
func (e *UnexpectedIDErr) Error() string {
|
||
|
return fmt.Sprintf("unexpected id %#x", e.ID)
|
||
|
}
|
||
|
|
||
|
// NewUnexpectedID return new UnexpectedIDErr.
|
||
|
func NewUnexpectedID(id uint32) error {
|
||
|
return &UnexpectedIDErr{ID: id}
|
||
|
}
|