-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patherrors.go
More file actions
36 lines (27 loc) · 972 Bytes
/
errors.go
File metadata and controls
36 lines (27 loc) · 972 Bytes
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
package tnetstrings
import (
"errors"
"fmt"
"reflect"
)
// ErrUnsupportedType means the argument type is not eligible to encode/decode.
type ErrUnsupportedType struct {
reflect.Type
}
func (e ErrUnsupportedType) Error() string {
return fmt.Sprintf("unsupported type: %s", e.Type)
}
// ErrNonStringKey means passed map has non-string key which is not accepted in tnetstrings.
var ErrNonStringKey = errors.New("non string key")
// ErrSizeLimitExceeded means SIZE is longer than 9 digits.
var ErrSizeLimitExceeded = errors.New("size limit exceeded")
// ErrInvalidSizeChar means there's a non-digit character before `:`.
type ErrInvalidSizeChar uint8
func (e ErrInvalidSizeChar) Error() string {
return fmt.Sprintf("invalid size char: %s", string(e))
}
// ErrInvalidTypeChar means the payload doesn't end with one of `,#^!~}]`.
type ErrInvalidTypeChar uint8
func (e ErrInvalidTypeChar) Error() string {
return fmt.Sprintf("invalid type char: %s", string(e))
}