-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrors.go
42 lines (31 loc) · 1.1 KB
/
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
package validator
import (
"errors"
"fmt")
func ErrMustBeMore(name string, value interface{}) error {
return errors.New(fmt.Sprintf("%v must be more than %v", name, value))
}
func ErrMustBeLess(name string, value interface{}) error {
return errors.New(fmt.Sprintf("%v must be less than %v", name, value))
}
func ErrMustBeEqual(name string, value interface{}) error {
return errors.New(fmt.Sprintf("%v must be equal %v", name, value))
}
func ErrMustNotBeEqual(name string, value interface{}) error {
return errors.New(fmt.Sprintf("%v must not be equal %v", name, value))
}
func ErrLenTooShort(name string) error {
return errors.New(fmt.Sprintf("%v is too short", name))
}
func ErrLenTooLong(name string) error {
return errors.New(fmt.Sprintf("%v is too long", name))
}
func ErrLenMustBe(name string, value interface{}) error {
return errors.New(fmt.Sprintf("%v must be %v characters long", name, value))
}
func ErrInvalidFormat(name string) error {
return errors.New(fmt.Sprintf("%v have invalid format", name))
}
func ErrRequired(name string) error {
return errors.New(fmt.Sprintf("%v is required", name))
}