IEnumerator AuthenticateAsync() { Terminal.LogImportant("AuthenticateAsync"); // get task var result1 = Repository.Authenticate(AuthKey, Roles); // wait for it yield return(StartCoroutine(result1.WaitRoutine())); // client error result1.ThrowIfFaulted(); // server error if (result1.Result.hasError) { throw new Exception(result1.Result.error.message); } Terminal.LogSuccess("Authenticated"); }