Synchronous errors
Handle synchronous exceptions thrown by the Instant Games SDK in C# or JavaScript.
Synchronous exceptions refer to all errors except those thrown while awaiting an asynchronous task. Most exceptions thrown in C# fall into this category.
Error handling
If the error occurs in C#, handle it with the try
/catch
mechanism.
If the error occurs in JavaScript, it's represented by JsException
. Even though the JsException
originates in JavaScript, you can still handle it in C# using try
/catch
:
try
{
// call an SDK endpoint or access an SDK object property
}
catch (JsException e)
{
// respond to the failure
}