-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.go
More file actions
43 lines (35 loc) · 2.04 KB
/
error.go
File metadata and controls
43 lines (35 loc) · 2.04 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
package restapi
import "errors"
// Sentinel errors returned by the package. All are safe to compare with
// [errors.Is]; the registry functions wrap them with additional context (for
// example, the offending error code) using [fmt.Errorf] with %w.
var (
// ErrUnknownErrorCode indicates that a lookup was attempted for an error
// code that is not present in the [ErrorRegistry]. It is returned from
// [ErrorRegistry.MustLookup] and wrapped with the code.
ErrUnknownErrorCode = errors.New("unknown error code")
// ErrCodeAlreadyRegistered indicates that [ErrorRegistry.Register] was
// called with an error code that was already present in the registry
// (either from an earlier call or earlier in the same batch).
ErrCodeAlreadyRegistered = errors.New("error code already registered")
// ErrFallbackErrorCodeRegistration indicates that [ErrorRegistry.Register]
// was called with an error code that matches the registry's fallback
// entry. The fallback is resolved by fallback semantics, not by a
// registered entry, and must not be double-registered.
ErrFallbackErrorCodeRegistration = errors.New("fallback error code cannot be registered")
// ErrInvalidPaginationLimit indicates that a pagination request carries a
// non-positive limit. It is returned by [OffsetPaginationRequest.Validate]
// and [CursorPaginationRequest.Validate].
ErrInvalidPaginationLimit = errors.New("invalid limit")
// ErrInvalidPaginationOffset indicates that a pagination request carries a
// negative offset. It is returned by [OffsetPaginationRequest.Validate].
ErrInvalidPaginationOffset = errors.New("invalid offset")
// ErrInvalidPaginationPageSize indicates that a pagination request carries
// a non-positive page size. It is returned by
// [PagePaginationRequest.Validate].
ErrInvalidPaginationPageSize = errors.New("invalid page size")
// ErrInvalidPaginationPageNumber indicates that a pagination request
// carries a negative page number. It is returned by
// [PagePaginationRequest.Validate].
ErrInvalidPaginationPageNumber = errors.New("invalid page number")
)