+4
-4
lex/util/decoder.go
+4
-4
lex/util/decoder.go
···
34
34
func NewFromType(typ string) (interface{}, error) {
35
35
t, ok := lexTypesMap[typ]
36
36
if !ok {
37
-
return nil, fmt.Errorf("unknown type: %q", typ)
37
+
return nil, fmt.Errorf("%w: %q", ErrUnrecognizedType, typ)
38
38
}
39
39
v := reflect.New(t)
40
40
return v.Interface(), nil
···
48
48
49
49
t, ok := lexTypesMap[tstr]
50
50
if !ok {
51
-
return nil, fmt.Errorf("unrecognized type: %q", tstr)
51
+
return nil, fmt.Errorf("%w: %q", ErrUnrecognizedType, tstr)
52
52
}
53
53
54
54
val := reflect.New(t)
···
66
66
cbg.CBORMarshaler
67
67
}
68
68
69
-
var ErrUnrecognizedType = fmt.Errorf("unrecognized type")
69
+
var ErrUnrecognizedType = fmt.Errorf("unrecognized lexicon type")
70
70
71
71
func CborDecodeValue(b []byte) (CBOR, error) {
72
72
tstr, err := CborTypeExtract(b)
···
76
76
77
77
t, ok := lexTypesMap[tstr]
78
78
if !ok {
79
-
return nil, fmt.Errorf("handling %q: %w", tstr, ErrUnrecognizedType)
79
+
return nil, fmt.Errorf("%w: %q", ErrUnrecognizedType, tstr)
80
80
}
81
81
82
82
val := reflect.New(t)