rdev/internal/domain/errors.go
jordan 72d16929ca feat: Implement hexagonal architecture with services, webhooks, queue, and telemetry
Major refactoring to hexagonal (ports & adapters) architecture:

- Add service layer (apikey_service, project_service) for business logic
- Add webhook system with dispatcher and delivery tracking
- Add command queue with priority-based processing
- Add rate limiting with sliding window algorithm
- Add audit logging for command execution
- Add OpenTelemetry integration (traces, metrics, spans)
- Add circuit breaker for fault tolerance
- Add cached repository wrapper for performance
- Add comprehensive validation package
- Add Kubernetes client integration for pod management
- Add database migrations (allowed_ips, audit_log, rate_limiting, queue, webhooks)
- Add network policy and PodDisruptionBudget for k8s
- Remove legacy executor and projects/registry packages
- Untrack secrets.yaml (now managed via envault)
- Add coverage.out to .gitignore
- Add e2e test infrastructure with docker-compose
- Add comprehensive documentation (API, architecture, operations, plans)
- Add golangci-lint config and pre-commit hook

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 19:57:46 -07:00

41 lines
1.4 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 (
// Project errors
ErrProjectNotFound = errors.New("project not found")
ErrProjectNotRunning = errors.New("project is not running")
// 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")
// 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")
// Rate limiting errors
ErrRateLimited = errors.New("rate limit exceeded")
// 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")
)