Skip to content

Commit

Permalink
🐛 Fix CrossHttpClient Failing requests (#41)
Browse files Browse the repository at this point in the history
* 🐛 Fix Failing requests

* 🐛 _currentRequestTask on exception
  • Loading branch information
GabrielePicco committed Jul 26, 2023
1 parent f5917ab commit 43dd564
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Solana.Unity.Rpc/Core/Http/CrossHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ private static async Task<HttpResponseMessage> SendUnityWebRequest(Uri uri, Http
{
response.Content = new StringContent("Error: " + e.Message);
response.StatusCode = HttpStatusCode.ExpectationFailed;
_currentRequestTask?.TrySetException(e);
_currentRequestTask = null;
}
return response;
}
Expand Down Expand Up @@ -104,7 +106,9 @@ private static Task<UnityWebRequest.Result> SendRequest(UnityWebRequest request)
}
catch (Exception ex)
{
sendRequestTask.SetException(ex);
sendRequestTask.TrySetException(ex);
_currentRequestTask.SetException(ex);
_currentRequestTask = null;
}
return sendRequestTask.Task;
}
Expand Down

0 comments on commit 43dd564

Please sign in to comment.