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

49 lines
2.1 KiB
Go

package reportget
// 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`. Stage 19's REST handler imports
// these names rather than redeclare them; renaming any of them is a
// contract change.
//
// Note: the report-get operation does **not** require the runtime to be
// in `running` state. Reports may be served against any runtime that
// exists in `runtime_records`; an unreachable engine surfaces naturally
// through `engine_unreachable`. Therefore `runtime_not_running` is not
// part of this vocabulary.
const (
// ErrorCodeInvalidRequest reports that the request envelope failed
// structural validation (empty required field, negative turn).
ErrorCodeInvalidRequest = "invalid_request"
// ErrorCodeRuntimeNotFound reports that no `runtime_records` row
// exists for the requested game id.
ErrorCodeRuntimeNotFound = "runtime_not_found"
// ErrorCodeForbidden reports that the caller is not an active member
// of the game, or that the (game_id, user_id) pair lacks a player
// mapping.
ErrorCodeForbidden = "forbidden"
// ErrorCodeEngineUnreachable reports that the engine /api/v1/report
// call returned a 5xx status, timed out, or could not be dispatched.
ErrorCodeEngineUnreachable = "engine_unreachable"
// ErrorCodeEngineValidationError reports that the engine returned
// 4xx. The body is forwarded verbatim through `Result.RawResponse`.
ErrorCodeEngineValidationError = "engine_validation_error"
// ErrorCodeEngineProtocolViolation reports that the engine response
// did not match the expected schema (empty body, malformed JSON).
// Stage 19 maps this to 502.
ErrorCodeEngineProtocolViolation = "engine_protocol_violation"
// ErrorCodeServiceUnavailable reports that a steady-state dependency
// (PostgreSQL, Lobby) was unreachable for this call.
ErrorCodeServiceUnavailable = "service_unavailable"
// ErrorCodeInternal reports an unexpected error not classified by
// the other codes.
ErrorCodeInternal = "internal_error"
)