-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrors.go
33 lines (26 loc) · 866 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
package nagato
import (
"errors"
"fmt"
"strings"
)
// List of errors.
var (
ErrInvalidDate = errors.New("invalid date")
ErrForumTopicMissingQuery = errors.New("at least one of BoardID, SubboardID, or Query is required")
)
func (c *Client) errRequiredField(str string) error {
return fmt.Errorf("required %s", str)
}
func (c *Client) errGTField(str, value string) error {
return fmt.Errorf("%s must be greater than %s", str, value)
}
func (c *Client) errGTEField(str, value string) error {
return fmt.Errorf("%s must be greater than or equal %s", str, value)
}
func (c *Client) errLTEField(str, value string) error {
return fmt.Errorf("%s must be lower than or equal %s", str, value)
}
func (c *Client) errOneOfField(str, value string) error {
return fmt.Errorf("%s must be one of %s", str, strings.Join(strings.Split(value, " "), ","))
}