50 lines
2.1 KiB
Go
50 lines
2.1 KiB
Go
package orderput
|
|
|
|
// 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.
|
|
const (
|
|
// ErrorCodeInvalidRequest reports that the request envelope failed
|
|
// structural validation (empty required field, malformed payload,
|
|
// non-object payload, payload missing the `commands` array).
|
|
ErrorCodeInvalidRequest = "invalid_request"
|
|
|
|
// ErrorCodeRuntimeNotFound reports that no `runtime_records` row
|
|
// exists for the requested game id.
|
|
ErrorCodeRuntimeNotFound = "runtime_not_found"
|
|
|
|
// ErrorCodeRuntimeNotRunning reports that the runtime exists but its
|
|
// current status is not `running`. Hot-path orders are rejected
|
|
// outside the running state to avoid racing with admin transitions
|
|
// and turn generation.
|
|
ErrorCodeRuntimeNotRunning = "runtime_not_running"
|
|
|
|
// 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/order
|
|
// call returned a 5xx status, timed out, or could not be dispatched.
|
|
ErrorCodeEngineUnreachable = "engine_unreachable"
|
|
|
|
// ErrorCodeEngineValidationError reports that the engine returned
|
|
// 4xx with a per-command result. The body is forwarded verbatim
|
|
// through `Result.RawResponse`.
|
|
ErrorCodeEngineValidationError = "engine_validation_error"
|
|
|
|
// ErrorCodeEngineProtocolViolation reports that the engine response
|
|
// did not match the expected schema. 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"
|
|
)
|