41 lines
1.8 KiB
Go
41 lines
1.8 KiB
Go
// Package domain contains pure domain models with no external dependencies.
|
|
// These types represent the core business concepts of the service.
|
|
package domain
|
|
|
|
import "errors"
|
|
|
|
// Domain errors - these are business-level errors that should be translated
|
|
// to appropriate HTTP status codes by the handler layer.
|
|
var (
|
|
// ErrNotFound indicates a requested resource does not exist.
|
|
ErrNotFound = errors.New("not found")
|
|
|
|
// ErrExampleNotFound indicates the requested example does not exist.
|
|
ErrExampleNotFound = errors.New("example not found")
|
|
|
|
// ErrDuplicateExample indicates an example with the same name already exists.
|
|
ErrDuplicateExample = errors.New("example with this name already exists")
|
|
|
|
// ErrInvalidExampleName indicates the example name is invalid.
|
|
ErrInvalidExampleName = errors.New("invalid example name")
|
|
|
|
// Auth errors
|
|
ErrUserNotFound = errors.New("user not found")
|
|
ErrDuplicateEmail = errors.New("email already registered")
|
|
ErrInvalidCredentials = errors.New("invalid email or password")
|
|
ErrSessionNotFound = errors.New("session not found")
|
|
ErrSessionRevoked = errors.New("session has been revoked")
|
|
ErrInvalidAuthCode = errors.New("invalid or expired code")
|
|
ErrExpiredAuthCode = errors.New("code has expired")
|
|
ErrWeakPassword = errors.New("password does not meet requirements")
|
|
ErrUserSuspended = errors.New("account is suspended")
|
|
ErrRegistrationDisabled = errors.New("registration is disabled")
|
|
ErrNameTooLong = errors.New("name exceeds maximum length")
|
|
ErrEmailTooLong = errors.New("email exceeds maximum length")
|
|
ErrInvalidAvatarURL = errors.New("avatar URL must use http or https")
|
|
|
|
// Persona errors
|
|
ErrPersonaNotFound = errors.New("persona not found")
|
|
ErrDuplicateHandle = errors.New("persona with this handle already exists")
|
|
)
|