55package errors
66
77const (
8- codeTimeout = 1000
9- codeNetworkError = 1100
10- codeDBError = 1200
8+ codeDBError = 1100
9+ codePageTokenInvalid = 1200
1110)
1211
13- // Timeout returns a timeout error.
14- func Timeout (err error , opts ... Option ) error {
15- return Wrap (err , codeTimeout , opts ... )
16- }
17-
18- // IsTimeout if err is timeout.
19- func IsTimeout (err error ) bool {
20- return Is (err , codeTimeout )
21- }
22-
23- // UnwrapTimeout if err is timeout.
24- func UnwrapTimeout (err error ) (error , bool ) {
25- return Unwrap (err , codeTimeout )
26- }
27-
28- // NetworkError returns a network error.
29- func NetworkError (err error , opts ... Option ) error {
30- return Wrap (err , codeNetworkError , opts ... )
31- }
32-
33- // IsNetworkError if err is network error.
34- func IsNetworkError (err error ) bool {
35- return Is (err , codeNetworkError )
36- }
37-
38- // UnwrapNetworkError if err is network error.
39- func UnwrapNetworkError (err error ) (error , bool ) {
40- return Unwrap (err , codeNetworkError )
41- }
42-
4312// DBError returns a db error.
4413func DBError (err error , opts ... Option ) error {
4514 return Wrap (err , codeDBError , opts ... )
@@ -54,3 +23,18 @@ func IsDBError(err error) bool {
5423func UnwrapDBError (err error ) (error , bool ) {
5524 return Unwrap (err , codeDBError )
5625}
26+
27+ // PageTokenInvalid returns a page token invalid error.
28+ func PageTokenInvalid (err error , opts ... Option ) error {
29+ return Wrap (err , codePageTokenInvalid , opts ... )
30+ }
31+
32+ // IsPageTokenInvalid if err is page token invalid.
33+ func IsPageTokenInvalid (err error ) bool {
34+ return Is (err , codePageTokenInvalid )
35+ }
36+
37+ // UnwrapPageTokenInvalid if err is page token invalid.
38+ func UnwrapPageTokenInvalid (err error ) (error , bool ) {
39+ return Unwrap (err , codePageTokenInvalid )
40+ }
0 commit comments