Files
galaxy-game/backend/internal/runtime/errors.go
T
2026-05-06 10:14:55 +03:00

46 lines
2.0 KiB
Go

package runtime
import "errors"
// Sentinel errors. Handlers map them to the standard JSON envelope at
// the wire boundary; lobby and admin packages observe them through
// errors.Is when they need to branch on the domain reason.
var (
// ErrNotFound is returned when no row matches the requested
// primary key (engine version, runtime record, player mapping).
ErrNotFound = errors.New("runtime: not found")
// ErrInvalidInput reports request-level validation failures
// (empty fields, malformed semver, unknown enum values).
ErrInvalidInput = errors.New("runtime: invalid input")
// ErrConflict reports that the requested action conflicts with
// the current persisted state (illegal status transition, retry
// while a job is still in-flight, race against the reconciler).
ErrConflict = errors.New("runtime: conflict")
// ErrEngineVersionTaken means a duplicate primary key was
// observed when registering a new engine version row.
ErrEngineVersionTaken = errors.New("runtime: engine version already registered")
// ErrEngineVersionDisabled reports that a referenced engine
// version row exists but is marked disabled.
ErrEngineVersionDisabled = errors.New("runtime: engine version disabled")
// ErrPatchSemverIncompatible reports that an admin-requested
// version patch crosses major or minor boundary, which Galaxy
// disallows for in-place patching (per ARCHITECTURE.md §9).
ErrPatchSemverIncompatible = errors.New("runtime: patch must stay inside the same major/minor line")
// ErrJobQueueFull reports that the worker pool's buffered job
// channel is at capacity. Surfaced as 503 service_unavailable at
// the wire boundary; in practice the pool size and queue depth
// are budgeted in `BACKEND_RUNTIME_*` env vars so the operator
// can absorb peaks.
ErrJobQueueFull = errors.New("runtime: job queue full")
// ErrShutdown means the runtime service has stopped accepting
// work because the parent context was cancelled.
ErrShutdown = errors.New("runtime: shutting down")
)