Skip to main content
Most failed HyperX API calls throw HyperXServerException. Startup failures are separated into HyperXInitializationException.

Basic Pattern

try
{
    var meta = await HyperX.Core.PublicStorage.GetMeta("config/liveops.json");
    Debug.Log($"Hash: {meta.Hash}");
}
catch (HyperX.HyperXServerException ex)
{
    Debug.LogWarning($"HyperX error: {ex.ErrorCode}");
    Debug.LogWarning($"TraceId: {ex.TraceId}, RequestId: {ex.RequestId}");

    if (ex.ErrorCode == "STORAGE_OBJECT_NOT_FOUND")
    {
        // Use a default config or ask an operator to upload the file.
    }
}

Useful Fields

FieldUse
ErrorCodeStable code for branching in game logic.
ServerMessageHuman-readable server message.
StatusCodeHTTP status code.
TraceIdID used to connect the request to server logs.
RequestIdID for one request.
ContextExtra values such as filename, table key, or provider.
Show game-specific messages to players instead of raw server messages. Keep TraceId and RequestId in support logs.

Common Cases

SituationExample CodeRecommended Handling
Login requiredUNAUTHORIZEDRefresh the session, then return to login if refresh fails.
Missing fileSTORAGE_OBJECT_NOT_FOUNDUse a default asset or check Console upload state.
Invalid dataVALIDATION_ERRORMatch the JSON payload to the Console schema.
Invalid social tokenINVALID_PROVIDER_TOKENGet a fresh token from the provider SDK and retry login.
Muted chat senderCHAT_SENDER_MUTEDDisable chat input and show a muted-state message.

Download Errors

PublicStorage.Get(...) returns a progress object first. Handle the actual failure when awaiting progress.File.
var progress = HyperX.Core.PublicStorage.Get("patch/main.bundle", "patch/main.bundle");

try
{
    await progress.File;
}
catch (HyperX.HyperXServerException ex)
{
    Debug.LogWarning($"Download failed: {ex.ErrorCode}");
}