errors

package
v0.0.5-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2026 License: AGPL-3.0 Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ErrorCodeCredentialsRequired = "credentials_required"
	ErrorCodeCredentialsInvalid  = "credentials_invalid"
)

Structured error detail codes.

View Source
const (
	CredentialTargetKindGitClone  = "git_clone"
	CredentialTargetKindImagePull = "image_pull"
	CredentialTargetKindImagePush = "image_push"
)

Kinds of credential targets for structured credential errors.

View Source
const (
	// resource shape
	VErrResourceNameRequired  = "resource_name_required"
	VErrResourceNameInvalid   = "resource_name_invalid"
	VErrResourceNameDuplicate = "resource_name_duplicate"
	VErrSourceRequired        = "source_required"
	VErrSourceConflict        = "source_conflict"
	VErrWorkloadTypeInvalid   = "workload_type_invalid"
	VErrScheduleRequired      = "schedule_required"
	VErrScheduleNotAllowed    = "schedule_not_allowed"
	VErrScheduleInvalid       = "schedule_invalid"
	VErrReplicasInvalid       = "replicas_invalid"

	// ports
	VErrPortsNotAllowed     = "ports_not_allowed"
	VErrPublicPortNotHTTP   = "public_port_not_http"
	VErrPortProtocolInvalid = "port_protocol_invalid"
	VErrPortNameInvalid     = "port_name_invalid"
	VErrPortNumberInvalid   = "port_number_invalid"
	VErrPortNameDuplicate   = "port_name_duplicate"
	VErrPortNumberDuplicate = "port_number_duplicate"
	VErrSubdomainDuplicate  = "subdomain_duplicate"
	VErrDomainNotConfigured = "domain_not_configured"

	// postgres addons
	VErrPostgresExternalImportDisabled = "postgres_external_import_disabled"

	// env
	VErrEnvNameRequired      = "env_name_required"
	VErrEnvNameDuplicate     = "env_name_duplicate"
	VErrEnvValueMissing      = "env_value_missing"
	VErrEnvValueConflict     = "env_value_conflict"
	VErrEnvSelfOutputUnknown = "env_self_output_unknown"

	// volume mounts
	VErrVolumeMountInvalid = "volume_mount_invalid"
	VErrVolumeNotFound     = "volume_not_found"
	VErrVolumeHashMissing  = "volume_hash_missing"

	// referenced entities
	VErrSecretNotFound             = "secret_not_found"
	VErrGitIntegrationNotFound     = "git_integration_not_found"
	VErrRegistryCredentialNotFound = "registry_credential_not_found"

	// depends_on
	VErrDependencySelf      = "self_dependency"
	VErrDependencyDuplicate = "duplicate_dependency"
	VErrDependencyUnknown   = "unknown_dependency"
	VErrDependencyCycle     = "dependency_cycle"

	// build / git / image source shape
	VErrGitRepoURLRequired   = "git_repo_url_required"
	VErrGitBranchTagConflict = "git_branch_tag_conflict"
	VErrGitCommitInvalid     = "git_commit_invalid"
	VErrGitCommitRequiresRef = "git_commit_requires_ref"
	VErrImageRefRequired     = "image_ref_required"
	VErrImageRefInvalid      = "image_ref_invalid"
	VErrPushTargetRequired   = "push_target_required"
	VErrPushTargetConflict   = "push_target_conflict"
	VErrPushRefInvalid       = "push_ref_invalid"

	// release-time (sync resolvePins + async worker)
	VErrGitRepoUnreachable = "git_repo_unreachable"
	VErrGitAuthFailed      = "git_auth_failed"
	VErrGitBranchNotFound  = "git_branch_not_found"
	VErrGitTagNotFound     = "git_tag_not_found"
	VErrGitRateLimited     = "git_rate_limited"
	VErrImageNotFound      = "image_not_found"
	// VErrRegistryCredentialsRequired means the registry rejected anonymous
	// access and NO credentials were configured for it — the fix is adding
	// credentials, not correcting them (that case is VErrRegistryAuthFailed
	// / VErrPushAccessDenied).
	VErrRegistryCredentialsRequired = "registry_credentials_required"
	VErrRegistryAuthFailed          = "registry_auth_failed"
	VErrPushAccessDenied            = "push_access_denied"

	// stack-level (name, settings, connections, interpolations)
	VErrStackNameInvalid     = "stack_name_invalid"
	VErrStackSettingsInvalid = "stack_settings_invalid"
	VErrConnectionInvalid    = "connection_invalid"
)

Validation error codes surfaced in FieldError.Code. Shared by create-time validation and release-time checks; the frontend switches on these.

Variables

This section is empty.

Functions

func IsRetryable

func IsRetryable(err error) bool

Types

type CredentialErrorDetails

type CredentialErrorDetails struct {
	Code   string                `json:"code"`
	Target CredentialErrorTarget `json:"target"`
}

CredentialErrorDetails is the structured payload for credential errors.

type CredentialErrorTarget

type CredentialErrorTarget struct {
	Kind string `json:"kind"`
	Host string `json:"host"`
	Ref  string `json:"ref"`
}

CredentialErrorTarget identifies what a credential error is about.

type FieldError

type FieldError struct {
	Field   string `json:"field"`
	Code    string `json:"code"`
	Message string `json:"message"`
}

FieldError is one machine-readable validation failure, addressed to a field of the request body (JSON path, e.g. "ports[0].protocol").

type OperationError

type OperationError struct {
	Reason    string
	Message   string
	Retryable bool
	Err       error
}

func Permanent

func Permanent(reason, message string) *OperationError

func Transient

func Transient(reason, message string) *OperationError

func (*OperationError) Error

func (e *OperationError) Error() string

func (*OperationError) IsRetryable

func (e *OperationError) IsRetryable() bool

func (*OperationError) Unwrap

func (e *OperationError) Unwrap() error

type RetryableError

type RetryableError interface {
	error
	IsRetryable() bool
}

type ServiceError

type ServiceError struct {
	// Code is the numeric and distinct ID for the error
	Code ServiceErrorCode
	// Reason is the context-specific reason the error was generated
	Reason string
	// HttopCode is the HttpCode associated with the error when the error is returned as an API response
	HttpCode int
	// Details optionally carries structured, machine-readable error context
	// that is serialized into the API error response.
	Details any
}

func BadRequest

func BadRequest(reason string, values ...interface{}) *ServiceError

func ComputeAccessInactive

func ComputeAccessInactive() *ServiceError

func ComputeQuotaExceeded

func ComputeQuotaExceeded(reason string, values ...interface{}) *ServiceError

func Conflict

func Conflict(reason string, values ...interface{}) *ServiceError

func CredentialsInvalid

func CredentialsInvalid(target CredentialErrorTarget, reason string, values ...interface{}) *ServiceError

CredentialsInvalid returns a 400 telling the client the configured credentials for a target failed.

func CredentialsRequired

func CredentialsRequired(target CredentialErrorTarget, reason string, values ...interface{}) *ServiceError

CredentialsRequired returns a 400 telling the client which target needs credentials that were not supplied.

func Find

func Find(code ServiceErrorCode) (bool, *ServiceError)

func Forbidden

func Forbidden(reason string, values ...interface{}) *ServiceError

func GeneralError

func GeneralError(reason string, values ...interface{}) *ServiceError

func Gone

func Gone(reason string, values ...interface{}) *ServiceError

func InternalServerError

func InternalServerError(reason string, values ...interface{}) *ServiceError

func MalformedRequest

func MalformedRequest(reason string, values ...interface{}) *ServiceError

func New

func New(code ServiceErrorCode, reason string, values ...interface{}) *ServiceError

Reason can be a string with format verbs, which will be replace by the specified values

func NotFound

func NotFound(reason string, values ...interface{}) *ServiceError

func NotImplemented

func NotImplemented(reason string, values ...interface{}) *ServiceError

func SharedComputeCapacityReached

func SharedComputeCapacityReached() *ServiceError

func TooManyRequests

func TooManyRequests(reason string, values ...interface{}) *ServiceError

func Unauthenticated

func Unauthenticated(reason string, values ...interface{}) *ServiceError

func Unauthorized

func Unauthorized(reason string, values ...interface{}) *ServiceError

func UnprocessableEntity

func UnprocessableEntity(reason string, values ...interface{}) *ServiceError

func Validation

func Validation(reason string, values ...interface{}) *ServiceError

func ValidationFailed

func ValidationFailed(fieldErrors []FieldError) *ServiceError

ValidationFailed returns a 400 carrying every collected field error.

func (*ServiceError) AsError

func (e *ServiceError) AsError() error

func (*ServiceError) AsOpenapiError

func (e *ServiceError) AsOpenapiError() openapi.Error

func (*ServiceError) Error

func (e *ServiceError) Error() string

func (*ServiceError) Is404

func (e *ServiceError) Is404() bool

func (*ServiceError) IsConflict

func (e *ServiceError) IsConflict() bool

func (*ServiceError) IsForbidden

func (e *ServiceError) IsForbidden() bool

func (*ServiceError) WithDetails

func (e *ServiceError) WithDetails(details any) *ServiceError

WithDetails attaches structured details to the error.

func (*ServiceError) WithPrefix

func (e *ServiceError) WithPrefix(format string, a ...interface{}) *ServiceError

type ServiceErrorCode

type ServiceErrorCode int
const (

	// InvalidToken occurs when a token is invalid (generally, not found in the database)
	ErrorInvalidToken ServiceErrorCode = 1

	// Forbidden occurs when a user has been blacklisted
	ErrorForbidden ServiceErrorCode = 4

	// Conflict occurs when a database constraint is violated
	ErrorConflict ServiceErrorCode = 6

	// NotFound occurs when a record is not found in the database
	ErrorNotFound ServiceErrorCode = 7

	// Validation occurs when an object fails validation
	ErrorValidation ServiceErrorCode = 8

	// General occurs when an error fails to match any other error code
	ErrorGeneral ServiceErrorCode = 9

	// NotImplemented occurs when an API REST method is not implemented in a handler
	ErrorNotImplemented ServiceErrorCode = 10

	// Unauthorized occurs when the requester is not authorized to perform the specified action
	ErrorUnauthorized ServiceErrorCode = 11

	// Unauthenticated occurs when the provided credentials cannot be validated
	ErrorUnauthenticated ServiceErrorCode = 15

	// MalformedRequest occurs when the request body cannot be read
	ErrorMalformedRequest ServiceErrorCode = 17

	// Bad Request
	ErrorBadRequest ServiceErrorCode = 21

	// Gone
	ErrorGone ServiceErrorCode = 24

	// Too Many Requests
	ErrorTooManyRequests ServiceErrorCode = 25

	// Unprocessable Entity
	ErrorUnprocessableEntity ServiceErrorCode = 26

	// InternalServerError
	ErrorInternalServerError ServiceErrorCode = 27

	// ComputeAccessInactive occurs when an organisation's compute entitlement or lease is inactive.
	ErrorComputeAccessInactive ServiceErrorCode = 28

	// SharedComputeCapacityReached occurs when all shared-compute leases are reserved.
	ErrorSharedComputeCapacityReached ServiceErrorCode = 29

	// ComputeQuotaExceeded occurs when a configured managed-compute limit is exceeded.
	ErrorComputeQuotaExceeded ServiceErrorCode = 30
)

type ServiceErrors

type ServiceErrors []ServiceError

func Errors

func Errors() ServiceErrors

type ValidationErrorDetails

type ValidationErrorDetails struct {
	Errors []FieldError `json:"errors"`
}

ValidationErrorDetails is the structured payload carried in Error.details for aggregated validation failures.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL