Files
ocdp-go/backend/internal/domain/entity/errors.go
Ivan087 33ddaf97db fix: scale replicas in response, K8s metrics client, quota precheck, auth tests
- Add GetMetrics method to MetricsClient interface and implement cluster metrics API
- Add QuotaPrecheck service for validating resource quotas before deployment
- Add auth DTO with role/permission models and auth handler tests
- Add instance diagnostics: mounted NFS volumes, labels, annotations in pod diagnostics
- Update workspace handler with GetWorkspace endpoint and shared-user list
- Fix monitoring handler to use correct service method name
- Add tail_lines fallback in instance handler for snake_case query params
- Update nginx config for SSE log streaming support (no buffering)
- Add comprehensive test coverage: auth_service_test, auth_handler_test,
  auth_dto_test, metrics_client_test, quota_precheck_test
- Update error messages for quota validation and instance operations
- ModifyModal: fix YAML lineWidth:0, modified keys summary, delta-only submit
- InstanceCard: correctly disable scale-minus when replicas <= 0
- SidebarLayout: add hover transition for sidebar items
- Update todo.md and lessons.md with latest fixes
2026-05-20 16:56:29 +08:00

52 lines
2.2 KiB
Go

package entity
import "errors"
// 领域错误定义
var (
// User errors
ErrInvalidUsername = errors.New("invalid username")
ErrInvalidPassword = errors.New("invalid password")
ErrUserNotFound = errors.New("user not found")
ErrUserExists = errors.New("user already exists")
ErrTokenRevoked = errors.New("token has been revoked")
ErrUnauthorized = errors.New("authentication required")
ErrForbidden = errors.New("permission denied")
ErrUserInactive = errors.New("user is inactive")
ErrWorkspaceSuspended = errors.New("workspace is suspended")
// Cluster errors
ErrInvalidClusterName = errors.New("invalid cluster name")
ErrInvalidClusterHost = errors.New("invalid cluster host")
ErrInvalidClusterAuth = errors.New("invalid cluster authentication config")
ErrClusterNotFound = errors.New("cluster not found")
ErrClusterExists = errors.New("cluster already exists")
// Registry errors
ErrInvalidRegistryName = errors.New("invalid registry name")
ErrInvalidRegistryURL = errors.New("invalid registry URL")
ErrRegistryNotFound = errors.New("registry not found")
ErrRegistryExists = errors.New("registry already exists")
// Instance errors
ErrInvalidClusterID = errors.New("invalid cluster ID")
ErrInvalidInstanceName = errors.New("invalid instance name")
ErrInvalidNamespace = errors.New("invalid namespace")
ErrInvalidChart = errors.New("invalid chart name")
ErrInvalidVersion = errors.New("invalid version")
ErrInstanceNotFound = errors.New("instance not found")
ErrInstanceExists = errors.New("instance already exists")
// Artifact errors
ErrArtifactNotFound = errors.New("artifact not found")
ErrRepositoryNotFound = errors.New("repository not found")
ErrValuesSchemaNotFound = errors.New("values schema not found")
// Workspace errors
ErrWorkspaceNotFound = errors.New("workspace not found")
ErrWorkspaceExists = errors.New("workspace already exists")
ErrWorkspaceNamespaceConflict = errors.New("workspace namespace conflict")
ErrUserHasInstances = errors.New("user has active instances")
ErrProtectedNamespace = errors.New("protected namespace")
)