Landing page cookbook implementation (Weeks 1-4): Domain Infrastructure: - Add project_domains table with migration (013_project_domains.sql) - Add ProjectDomain model with domain types (primary_auto, primary_custom, alias) - Add SlugGenerator and ProjectDomainRepository interfaces - Implement postgres adapters for domain and slug management Service Layer: - Add domain CRUD methods to ProjectInfraService - Generate 8-char random slugs for auto-domains - Support custom subdomains during project creation - Add site_live health check to project status - Trigger CI build after template seeding Handler Updates: - Add DomainService interface and adapter pattern - Rewrite domain handlers to use database-backed service - Add proper error handling for duplicate/missing domains CI Integration: - Add TriggerBuild to CIProvider interface - Implement TriggerBuild in Woodpecker adapter - Manually trigger initial build after template seed Cookbook & Scripts: - Add landing-test.sh script for E2E testing - Add release.sh for version releases - Add logs.sh for quick log access Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
76 lines
2.6 KiB
Go
76 lines
2.6 KiB
Go
package domain
|
|
|
|
import "errors"
|
|
|
|
// Domain errors - these are business-level errors that should be translated
|
|
// to appropriate HTTP status codes or gRPC error codes by the presentation layer.
|
|
var (
|
|
// Generic errors
|
|
ErrNotFound = errors.New("not found")
|
|
|
|
// Project errors
|
|
ErrProjectNotFound = errors.New("project not found")
|
|
ErrProjectNotRunning = errors.New("project is not running")
|
|
ErrInvalidProjectName = errors.New("invalid project name")
|
|
|
|
// Template errors
|
|
ErrTemplateNotFound = errors.New("template not found")
|
|
|
|
// Command errors
|
|
ErrCommandNotFound = errors.New("command not found")
|
|
ErrCommandTimeout = errors.New("command timed out")
|
|
ErrCommandCancelled = errors.New("command was cancelled")
|
|
ErrLimitExceeded = errors.New("concurrent command limit exceeded")
|
|
ErrInvalidCommand = errors.New("invalid command")
|
|
ErrCommandSanitization = errors.New("command failed sanitization")
|
|
|
|
// Agent errors
|
|
ErrInvalidAgentProvider = errors.New("invalid agent provider")
|
|
ErrPromptRequired = errors.New("prompt is required")
|
|
ErrInvalidTimeout = errors.New("timeout cannot be negative")
|
|
|
|
// Credential errors
|
|
ErrCredentialNotFound = errors.New("credential not found")
|
|
|
|
// Work queue errors
|
|
ErrWorkTaskNotFound = errors.New("work task not found")
|
|
|
|
// Worker pool errors
|
|
ErrWorkerNotFound = errors.New("worker not found")
|
|
ErrWorkerIDRequired = errors.New("worker ID is required")
|
|
ErrWorkerHostnameRequired = errors.New("worker hostname is required")
|
|
|
|
// Build errors
|
|
ErrBuildNotFound = errors.New("build not found")
|
|
|
|
// API Key errors
|
|
ErrKeyNotFound = errors.New("api key not found")
|
|
ErrKeyRevoked = errors.New("api key has been revoked")
|
|
ErrKeyExpired = errors.New("api key has expired")
|
|
ErrKeyInvalid = errors.New("invalid api key format")
|
|
|
|
// Authorization errors
|
|
ErrUnauthorized = errors.New("unauthorized")
|
|
ErrForbidden = errors.New("forbidden")
|
|
ErrInsufficientScope = errors.New("insufficient scope")
|
|
ErrIPNotAllowed = errors.New("ip address not allowed")
|
|
|
|
// Rate limiting errors
|
|
ErrRateLimited = errors.New("rate limit exceeded")
|
|
|
|
// Webhook errors
|
|
ErrWebhookNotFound = errors.New("webhook not found")
|
|
ErrInvalidWebhook = errors.New("invalid webhook configuration")
|
|
|
|
// Domain errors
|
|
ErrDuplicateDomain = errors.New("domain already exists")
|
|
ErrDomainNotFound = errors.New("domain not found")
|
|
|
|
// Audit errors
|
|
ErrAuditNotFound = errors.New("audit log entry not found")
|
|
|
|
// Infrastructure errors (should typically be wrapped)
|
|
ErrDatabaseConnection = errors.New("database connection error")
|
|
ErrKubernetesError = errors.New("kubernetes error")
|
|
)
|