Error handling
Handle synchronous and asynchronous exceptions thrown by the Instant Games SDK.
The Instant Games SDK primarily uses two exception types to represent failed operations:
JsExceptionfor unexpected errors that occur during execution of JavaScript code. These errors are typically thrown synchronously.APIErrorfor errors related to usage of the SDK. These errors tend to occur asynchronously.
| Topic | Description |
|---|---|
| Synchronous errors | Handle synchronous exceptions thrown by the Instant Games SDK in C# or JavaScript. These include JsException errors that occur in JavaScript. |
| Asynchronous errors | Handle asynchronous exceptions thrown by the Instant Games SDK. These include errors of type APIError, related to SDK usage. |
| Synchronous errors thrown by async methods | Handle both JSException and APIError exception types when they're thrown by async methods. |