-
Notifications
You must be signed in to change notification settings - Fork 5
/
errors.go
43 lines (35 loc) · 939 Bytes
/
errors.go
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
37
38
39
40
41
42
43
package data
import (
"fmt"
"google.golang.org/protobuf/encoding/protowire"
)
type ErrWrongNodeType struct {
Expected int64
Actual int64
}
func (e ErrWrongNodeType) Error() string {
expectedName, ok := DataTypeNames[e.Expected]
if !ok {
expectedName = "Unknown Type"
}
actualName, ok := DataTypeNames[e.Actual]
if !ok {
actualName = "Unknown Type"
}
return fmt.Sprintf("incorrect Node Type: (UnixFSData) expected type: %s, actual type: %s", expectedName, actualName)
}
type ErrWrongWireType struct {
Module string
Field string
Expected protowire.Type
Actual protowire.Type
}
func (e ErrWrongWireType) Error() string {
return fmt.Sprintf("protobuf: (%s) invalid wireType, field: %s, expected %d, got %d", e.Module, e.Field, e.Expected, e.Actual)
}
type ErrInvalidDataType struct {
DataType int64
}
func (e ErrInvalidDataType) Error() string {
return fmt.Sprintf("type: %d is not valid", e.DataType)
}