A community based topic aggregation platform built on atproto
at main 26 lines 788 B view raw
1package userblocks 2 3import "errors" 4 5// Sentinel errors for user block operations 6var ( 7 // ErrBlockNotFound is returned when a block lookup finds no matching record 8 ErrBlockNotFound = errors.New("user block not found") 9 10 // ErrBlockAlreadyExists is returned when attempting to create a duplicate block 11 ErrBlockAlreadyExists = errors.New("user already blocked") 12 13 // ErrCannotBlockSelf is returned when a user attempts to block themselves 14 ErrCannotBlockSelf = errors.New("cannot block yourself") 15) 16 17// IsNotFound returns true if the error is ErrBlockNotFound 18func IsNotFound(err error) bool { 19 return errors.Is(err, ErrBlockNotFound) 20} 21 22// IsConflict returns true if the error is ErrBlockAlreadyExists 23func IsConflict(err error) bool { 24 return errors.Is(err, ErrBlockAlreadyExists) 25} 26