Total Lines | 36 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 0 |
1 | package encode |
||
2 | |||
3 | import ( |
||
4 | "errors" |
||
5 | "reflect" |
||
6 | ) |
||
7 | |||
8 | var ( |
||
9 | ErrInvalidValue = errors.New("invalid value") |
||
10 | ) |
||
11 | |||
12 | type UnsupportedTypeError struct { |
||
13 | Type reflect.Type |
||
14 | } |
||
15 | |||
16 | func (e *UnsupportedTypeError) Error() string { |
||
17 | return "binn: unsupported type: " + e.Type.String() |
||
18 | } |
||
19 | |||
20 | type MarshalerError struct { |
||
21 | Type reflect.Type |
||
22 | Err error |
||
23 | sourceFunc string |
||
24 | } |
||
25 | |||
26 | func (e *MarshalerError) Error() string { |
||
27 | srcFunc := e.sourceFunc |
||
28 | if srcFunc == "" { |
||
29 | srcFunc = "MarshalBINN" |
||
30 | } |
||
31 | return "binn: error calling " + srcFunc + |
||
32 | " for type " + e.Type.String() + |
||
33 | ": " + e.Err.Error() |
||
34 | } |
||
35 | |||
36 | func (e *MarshalerError) Unwrap() error { return e.Err } |
||
37 |