Overview
- When a HyperX Core API request fails, the SDK throws
HyperXServerException. - This lets the game client detect server failures and show a proper message to the player.
Exception fields
HyperXServerException includes the following fields:
-
ErrorCode: The server error code. -
Service: The internal service identifier where the error happened. -
ServerMessage: A human-readable error message from the server. -
StatusCode: The HTTP status code. -
TraceId: A trace identifier you can correlate with server logs. -
RequestId: A request-scoped identifier. -
Context: Additional context values useful for debugging. -
ResponseBody: The raw response body returned by the server. -
Even when the server response does not include a
codefield yet, the SDK generates a fallback code such asSTORAGE_OBJECT_NOT_FOUND. -
When the server includes
service,traceId,requestId, orcontextin the response body, the SDK parses them into structured fields. -
If the body does not include tracing metadata, the SDK falls back to
x-service,x-trace-id, andx-request-idresponse headers.
Basic example
Handling patterns
- APIs that are awaited directly, such as
GetMeta,GetHash, andCore.GetTime, can be handled with a normaltry/catch. PublicStorage.Get(...)returnsFileDownloadProgressimmediately, so download failures should be handled atawait progress.File.