Something went wrong. Try again.
A community based topic aggregation platform built on atproto
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687package comments
import ( "errors"
"Coves/internal/core/richtext")
var ( // ErrCommentNotFound indicates the requested comment doesn't exist ErrCommentNotFound = errors.New("comment not found")
// ErrInvalidReply indicates the reply reference is malformed or invalid ErrInvalidReply = errors.New("invalid reply reference")
// ErrParentNotFound indicates the parent post/comment doesn't exist ErrParentNotFound = errors.New("parent post or comment not found")
// ErrRootNotFound indicates the root post doesn't exist ErrRootNotFound = errors.New("root post not found")
// ErrContentTooLong indicates comment content exceeds 10000 graphemes ErrContentTooLong = errors.New("comment content exceeds 10000 graphemes")
// ErrContentEmpty indicates comment content is empty ErrContentEmpty = errors.New("comment content is required")
// ErrInvalidFacets indicates rich text facets are malformed or reference // byte ranges outside the comment content ErrInvalidFacets = errors.New("invalid rich text facets")
// ErrNotAuthorized indicates the user is not authorized to perform this action ErrNotAuthorized = errors.New("not authorized")
// ErrBanned indicates the user is banned from the community ErrBanned = errors.New("user is banned from this community")
// ErrCommentAlreadyExists indicates a comment with this URI already exists ErrCommentAlreadyExists = errors.New("comment already exists")
// ErrConcurrentModification indicates the comment was modified since it was loaded ErrConcurrentModification = errors.New("comment was modified by another operation")
// ErrInvalidCursor indicates a malformed or sort-mismatched pagination cursor ErrInvalidCursor = errors.New("invalid pagination cursor")
// ErrInvalidEmbed indicates the comment embed fails the lexicon or carries an // image that is not a well-formed image blob ref ErrInvalidEmbed = errors.New("invalid embed")
// ErrTooManyImages marks a comment refused because its images embed carries more than eight images (XRPC TooManyImages, 400) ErrTooManyImages = errors.New("too many images")
// ErrInvalidRecord indicates the comment record about to be written fails // the social.coves.community.comment lexicon somewhere other than its embed ErrInvalidRecord = errors.New("comment record does not satisfy the lexicon")
// ErrInvalidImageFacet marks a comment refused because an #image facet // breaks a write rule (XRPC InvalidImageFacet, 400). It is richtext's // sentinel, so the rule check's own error matches it without re-wrapping. // It does not match ErrInvalidFacets or ErrInvalidEmbed. ErrInvalidImageFacet = richtext.ErrInvalidImageFacet)
// IsNotFound checks if an error is a "not found" errorfunc IsNotFound(err error) bool { return errors.Is(err, ErrCommentNotFound) || errors.Is(err, ErrParentNotFound) || errors.Is(err, ErrRootNotFound)}
// IsConflict checks if an error is a conflict/already exists errorfunc IsConflict(err error) bool { return errors.Is(err, ErrCommentAlreadyExists) || errors.Is(err, ErrConcurrentModification)}
// IsValidationError checks if an error is a validation errorfunc IsValidationError(err error) bool { return errors.Is(err, ErrInvalidReply) || errors.Is(err, ErrContentTooLong) || errors.Is(err, ErrContentEmpty) || errors.Is(err, ErrInvalidFacets) || errors.Is(err, ErrInvalidCursor) || errors.Is(err, ErrInvalidRecord)}