Files
galaxy-game/gamemaster/internal/service/adminforce/errors.go
T
2026-05-03 07:59:03 +02:00

51 lines
2.0 KiB
Go

package adminforce
// Stable error codes returned in `Result.ErrorCode`. The values match
// the vocabulary frozen by `gamemaster/README.md §Error Model` and
// `gamemaster/api/internal-openapi.yaml`. Service-layer callers (Stage
// 19 handlers) import these names rather than redeclare them; renaming
// any of them is a contract change.
const (
// ErrorCodeInvalidRequest reports that the request envelope failed
// structural validation (empty GameID).
ErrorCodeInvalidRequest = "invalid_request"
// ErrorCodeRuntimeNotFound reports that the underlying turn
// generation could not find a runtime_records row for the
// requested game id.
ErrorCodeRuntimeNotFound = "runtime_not_found"
// ErrorCodeRuntimeNotRunning reports that the runtime is not in
// `running`. Force-next-turn requires the same precondition the
// scheduler ticker enforces.
ErrorCodeRuntimeNotRunning = "runtime_not_running"
// ErrorCodeConflict reports that the underlying CAS to
// `generation_in_progress` lost the race to a concurrent mutation
// (admin stop / health observation / scheduler tick).
ErrorCodeConflict = "conflict"
// ErrorCodeEngineUnreachable reports that the engine /admin/turn
// call returned a 5xx, timed out, or could not be dispatched.
ErrorCodeEngineUnreachable = "engine_unreachable"
// ErrorCodeEngineValidationError reports that the engine
// /admin/turn call returned a 4xx.
ErrorCodeEngineValidationError = "engine_validation_error"
// ErrorCodeEngineProtocolViolation reports that the engine
// response did not match the expected schema or the installed
// roster.
ErrorCodeEngineProtocolViolation = "engine_protocol_violation"
// ErrorCodeServiceUnavailable reports that a steady-state
// dependency (PostgreSQL, Redis, Lobby) was unreachable for this
// call. Also covers the post-success scheduling write that
// installs `skip_next_tick=true`.
ErrorCodeServiceUnavailable = "service_unavailable"
// ErrorCodeInternal reports an unexpected error not classified by
// the other codes.
ErrorCodeInternal = "internal_error"
)