-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.go
More file actions
45 lines (33 loc) · 1.21 KB
/
error.go
File metadata and controls
45 lines (33 loc) · 1.21 KB
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
44
45
package mapper
// ErrUnmatchType error occured when source struct's field and target struct's field has unmatch data type
type ErrUnmatchType string
func (errUnmatchTy ErrUnmatchType) Error() string {
return string(errUnmatchTy)
}
func errUnmatchType(fsrc, fdest string) ErrUnmatchType {
return ErrUnmatchType(fsrc + " and " + fdest + " has unmatch type")
}
// ErrUnsupported error occured when trying to map non struct or pointer to struct
type ErrUnsupported string
func (errUnsupported ErrUnsupported) Error() string {
return string(errUnsupported)
}
func errUnsupported(name string) ErrUnsupported {
return ErrUnsupported(name + " is not supported, only struct or pointer to struct is supported")
}
// ErrNil error occured when trying to map nil struct
type ErrNil string
func (errNil ErrNil) Error() string {
return string(errNil)
}
func errNil(name string) ErrNil {
return ErrNil(name + " is nil")
}
// ErrDestNotPointer error occured when trying to map source to non pointer destination
type ErrDestNotPointer string
func (errDestNotPointer ErrDestNotPointer) Error() string {
return string(errDestNotPointer)
}
func errDestNotPointer() ErrDestNotPointer {
return ErrDestNotPointer("destination is not pointer")
}