A community based topic aggregation platform built on atproto
1package communityFeeds
2
3import (
4 "errors"
5 "fmt"
6)
7
8var (
9 // ErrCommunityNotFound is returned when the community doesn't exist
10 ErrCommunityNotFound = errors.New("community not found")
11
12 // ErrInvalidCursor is returned when the pagination cursor is invalid
13 ErrInvalidCursor = errors.New("invalid pagination cursor")
14)
15
16// ValidationError represents an input validation error
17type ValidationError struct {
18 Field string
19 Message string
20}
21
22func (e *ValidationError) Error() string {
23 return fmt.Sprintf("validation error: %s: %s", e.Field, e.Message)
24}
25
26// NewValidationError creates a new validation error
27func NewValidationError(field, message string) error {
28 return &ValidationError{
29 Field: field,
30 Message: message,
31 }
32}
33
34// IsValidationError checks if an error is a validation error
35func IsValidationError(err error) bool {
36 var ve *ValidationError
37 return errors.As(err, &ve)
38}