{"modulePath":"github.com/Stackdome/stackdome","version":"v0.0.7-alpha","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package errors\n\n## Constants\n\n```go\nconst (\n\tErrorCodeCredentialsRequired = \"credentials_required\"\n\tErrorCodeCredentialsInvalid  = \"credentials_invalid\"\n)\n```\nStructured error detail codes.\n\n```go\nconst (\n\tCredentialTargetKindGitClone  = \"git_clone\"\n\tCredentialTargetKindImagePull = \"image_pull\"\n\tCredentialTargetKindImagePush = \"image_push\"\n)\n```\nKinds of credential targets for structured credential errors.\n\n```go\nconst (\n\t// resource shape\n\tVErrResourceNameRequired  = \"resource_name_required\"\n\tVErrResourceNameInvalid   = \"resource_name_invalid\"\n\tVErrResourceNameDuplicate = \"resource_name_duplicate\"\n\tVErrSourceRequired        = \"source_required\"\n\tVErrSourceConflict        = \"source_conflict\"\n\tVErrWorkloadTypeInvalid   = \"workload_type_invalid\"\n\tVErrScheduleRequired      = \"schedule_required\"\n\tVErrScheduleNotAllowed    = \"schedule_not_allowed\"\n\tVErrScheduleInvalid       = \"schedule_invalid\"\n\tVErrReplicasInvalid       = \"replicas_invalid\"\n\n\t// ports\n\tVErrPortsNotAllowed     = \"ports_not_allowed\"\n\tVErrPublicPortNotHTTP   = \"public_port_not_http\"\n\tVErrPortProtocolInvalid = \"port_protocol_invalid\"\n\tVErrPortNameInvalid     = \"port_name_invalid\"\n\tVErrPortNumberInvalid   = \"port_number_invalid\"\n\tVErrPortNameDuplicate   = \"port_name_duplicate\"\n\tVErrPortNumberDuplicate = \"port_number_duplicate\"\n\tVErrSubdomainDuplicate  = \"subdomain_duplicate\"\n\tVErrDomainNotConfigured = \"domain_not_configured\"\n\n\t// postgres addons\n\tVErrPostgresExternalImportDisabled = \"postgres_external_import_disabled\"\n\n\t// env\n\tVErrEnvNameRequired      = \"env_name_required\"\n\tVErrEnvNameDuplicate     = \"env_name_duplicate\"\n\tVErrEnvValueMissing      = \"env_value_missing\"\n\tVErrEnvValueConflict     = \"env_value_conflict\"\n\tVErrEnvSelfOutputUnknown = \"env_self_output_unknown\"\n\n\t// volume mounts\n\tVErrVolumeMountInvalid = \"volume_mount_invalid\"\n\tVErrVolumeNotFound     = \"volume_not_found\"\n\tVErrVolumeHashMissing  = \"volume_hash_missing\"\n\n\t// referenced entities\n\tVErrSecretNotFound             = \"secret_not_found\"\n\tVErrGitIntegrationNotFound     = \"git_integration_not_found\"\n\tVErrRegistryCredentialNotFound = \"registry_credential_not_found\"\n\n\t// depends_on\n\tVErrDependencySelf      = \"self_dependency\"\n\tVErrDependencyDuplicate = \"duplicate_dependency\"\n\tVErrDependencyUnknown   = \"unknown_dependency\"\n\tVErrDependencyCycle     = \"dependency_cycle\"\n\n\t// build / git / image source shape\n\tVErrGitRepoURLRequired   = \"git_repo_url_required\"\n\tVErrGitBranchTagConflict = \"git_branch_tag_conflict\"\n\tVErrGitCommitInvalid     = \"git_commit_invalid\"\n\tVErrGitCommitRequiresRef = \"git_commit_requires_ref\"\n\tVErrImageRefRequired     = \"image_ref_required\"\n\tVErrImageRefInvalid      = \"image_ref_invalid\"\n\tVErrPushTargetRequired   = \"push_target_required\"\n\tVErrPushTargetConflict   = \"push_target_conflict\"\n\tVErrPushRefInvalid       = \"push_ref_invalid\"\n\n\t// release-time (sync resolvePins + async worker)\n\tVErrGitRepoUnreachable = \"git_repo_unreachable\"\n\tVErrGitAuthFailed      = \"git_auth_failed\"\n\tVErrGitBranchNotFound  = \"git_branch_not_found\"\n\tVErrGitTagNotFound     = \"git_tag_not_found\"\n\tVErrGitRateLimited     = \"git_rate_limited\"\n\tVErrImageNotFound      = \"image_not_found\"\n\t// VErrRegistryCredentialsRequired means the registry rejected anonymous\n\t// access and NO credentials were configured for it — the fix is adding\n\t// credentials, not correcting them (that case is VErrRegistryAuthFailed\n\t// / VErrPushAccessDenied).\n\tVErrRegistryCredentialsRequired = \"registry_credentials_required\"\n\tVErrRegistryAuthFailed          = \"registry_auth_failed\"\n\tVErrPushAccessDenied            = \"push_access_denied\"\n\n\t// stack-level (name, settings, connections, interpolations)\n\tVErrStackNameInvalid     = \"stack_name_invalid\"\n\tVErrStackSettingsInvalid = \"stack_settings_invalid\"\n\tVErrConnectionInvalid    = \"connection_invalid\"\n)\n```\nValidation error codes surfaced in FieldError.Code. Shared by create-time validation and release-time checks; the frontend switches on these.\n\n## Functions\n\n```go\nfunc IsRetryable(err error) bool\n```\n\n## Types\n\n```go\ntype CredentialErrorDetails struct {\n\tCode   string                `json:\"code\"`\n\tTarget CredentialErrorTarget `json:\"target\"`\n}\n```\nCredentialErrorDetails is the structured payload for credential errors.\n\n```go\ntype CredentialErrorTarget struct {\n\tKind string `json:\"kind\"`\n\tHost string `json:\"host\"`\n\tRef  string `json:\"ref\"`\n}\n```\nCredentialErrorTarget identifies what a credential error is about.\n\n```go\ntype FieldError struct {\n\tField   string `json:\"field\"`\n\tCode    string `json:\"code\"`\n\tMessage string `json:\"message\"`\n}\n```\nFieldError is one machine-readable validation failure, addressed to a field of the request body (JSON path, e.g. \"ports\\[0].protocol\").\n\n```go\ntype OperationError struct {\n\tReason    string\n\tMessage   string\n\tRetryable bool\n\tErr       error\n}\n```\n\n```go\nfunc Permanent(reason, message string) *OperationError\n```\n\n```go\nfunc Transient(reason, message string) *OperationError\n```\n\n```go\nfunc (e *OperationError) Error() string\n```\n\n```go\nfunc (e *OperationError) IsRetryable() bool\n```\n\n```go\nfunc (e *OperationError) Unwrap() error\n```\n\n```go\ntype RetryableError interface {\n\terror\n\tIsRetryable() bool\n}\n```\n\n```go\ntype ServiceError struct {\n\t// Code is the numeric and distinct ID for the error\n\tCode ServiceErrorCode\n\t// Reason is the context-specific reason the error was generated\n\tReason string\n\t// HttopCode is the HttpCode associated with the error when the error is returned as an API response\n\tHttpCode int\n\t// Details optionally carries structured, machine-readable error context\n\t// that is serialized into the API error response.\n\tDetails any\n}\n```\n\n```go\nfunc BadRequest(reason string, values ...interface{}) *ServiceError\n```\n\n```go\nfunc ComputeAccessInactive() *ServiceError\n```\n\n```go\nfunc ComputeQuotaExceeded(reason string, values ...interface{}) *ServiceError\n```\n\n```go\nfunc Conflict(reason string, values ...interface{}) *ServiceError\n```\n\n```go\nfunc CredentialsInvalid(target CredentialErrorTarget, reason string, values ...interface{}) *ServiceError\n```\nCredentialsInvalid returns a 400 telling the client the configured credentials for a target failed.\n\n```go\nfunc CredentialsRequired(target CredentialErrorTarget, reason string, values ...interface{}) *ServiceError\n```\nCredentialsRequired returns a 400 telling the client which target needs credentials that were not supplied.\n\n```go\nfunc Find(code ServiceErrorCode) (bool, *ServiceError)\n```\n\n```go\nfunc Forbidden(reason string, values ...interface{}) *ServiceError\n```\n\n```go\nfunc GeneralError(reason string, values ...interface{}) *ServiceError\n```\n\n```go\nfunc Gone(reason string, values ...interface{}) *ServiceError\n```\n\n```go\nfunc InternalServerError(reason string, values ...interface{}) *ServiceError\n```\n\n```go\nfunc MalformedRequest(reason string, values ...interface{}) *ServiceError\n```\n\n```go\nfunc New(code ServiceErrorCode, reason string, values ...interface{}) *ServiceError\n```\nReason can be a string with format verbs, which will be replace by the specified values\n\n```go\nfunc NotFound(reason string, values ...interface{}) *ServiceError\n```\n\n```go\nfunc NotImplemented(reason string, values ...interface{}) *ServiceError\n```\n\n```go\nfunc SharedComputeCapacityReached() *ServiceError\n```\n\n```go\nfunc TooManyRequests(reason string, values ...interface{}) *ServiceError\n```\n\n```go\nfunc Unauthenticated(reason string, values ...interface{}) *ServiceError\n```\n\n```go\nfunc Unauthorized(reason string, values ...interface{}) *ServiceError\n```\n\n```go\nfunc UnprocessableEntity(reason string, values ...interface{}) *ServiceError\n```\n\n```go\nfunc Validation(reason string, values ...interface{}) *ServiceError\n```\n\n```go\nfunc ValidationFailed(fieldErrors []FieldError) *ServiceError\n```\nValidationFailed returns a 400 carrying every collected field error.\n\n```go\nfunc (e *ServiceError) AsError() error\n```\n\n```go\nfunc (e *ServiceError) AsOpenapiError() openapi.Error\n```\n\n```go\nfunc (e *ServiceError) Error() string\n```\n\n```go\nfunc (e *ServiceError) Is404() bool\n```\n\n```go\nfunc (e *ServiceError) IsConflict() bool\n```\n\n```go\nfunc (e *ServiceError) IsForbidden() bool\n```\n\n```go\nfunc (e *ServiceError) WithDetails(details any) *ServiceError\n```\nWithDetails attaches structured details to the error.\n\n```go\nfunc (e *ServiceError) WithPrefix(format string, a ...interface{}) *ServiceError\n```\n\n```go\ntype ServiceErrorCode int\n```\n\n```go\nconst (\n\n\t// InvalidToken occurs when a token is invalid (generally, not found in the database)\n\tErrorInvalidToken ServiceErrorCode = 1\n\n\t// Forbidden occurs when a user has been blacklisted\n\tErrorForbidden ServiceErrorCode = 4\n\n\t// Conflict occurs when a database constraint is violated\n\tErrorConflict ServiceErrorCode = 6\n\n\t// NotFound occurs when a record is not found in the database\n\tErrorNotFound ServiceErrorCode = 7\n\n\t// Validation occurs when an object fails validation\n\tErrorValidation ServiceErrorCode = 8\n\n\t// General occurs when an error fails to match any other error code\n\tErrorGeneral ServiceErrorCode = 9\n\n\t// NotImplemented occurs when an API REST method is not implemented in a handler\n\tErrorNotImplemented ServiceErrorCode = 10\n\n\t// Unauthorized occurs when the requester is not authorized to perform the specified action\n\tErrorUnauthorized ServiceErrorCode = 11\n\n\t// Unauthenticated occurs when the provided credentials cannot be validated\n\tErrorUnauthenticated ServiceErrorCode = 15\n\n\t// MalformedRequest occurs when the request body cannot be read\n\tErrorMalformedRequest ServiceErrorCode = 17\n\n\t// Bad Request\n\tErrorBadRequest ServiceErrorCode = 21\n\n\t// Gone\n\tErrorGone ServiceErrorCode = 24\n\n\t// Too Many Requests\n\tErrorTooManyRequests ServiceErrorCode = 25\n\n\t// Unprocessable Entity\n\tErrorUnprocessableEntity ServiceErrorCode = 26\n\n\t// InternalServerError\n\tErrorInternalServerError ServiceErrorCode = 27\n\n\t// ComputeAccessInactive occurs when an organisation's compute entitlement or lease is inactive.\n\tErrorComputeAccessInactive ServiceErrorCode = 28\n\n\t// SharedComputeCapacityReached occurs when all shared-compute leases are reserved.\n\tErrorSharedComputeCapacityReached ServiceErrorCode = 29\n\n\t// ComputeQuotaExceeded occurs when a configured managed-compute limit is exceeded.\n\tErrorComputeQuotaExceeded ServiceErrorCode = 30\n)\n```\n\n```go\ntype ServiceErrors []ServiceError\n```\n\n```go\nfunc Errors() ServiceErrors\n```\n\n```go\ntype ValidationErrorDetails struct {\n\tErrors []FieldError `json:\"errors\"`\n}\n```\nValidationErrorDetails is the structured payload carried in Error.details for aggregated validation failures.\n\n","path":"github.com/Stackdome/stackdome/pkg/errors","name":"errors","synopsis":"","isRedistributable":true}
