diff --git a/Packages/io.chainsafe.web3-unity/Tests/Runtime/SampleTestsBase.cs b/Packages/io.chainsafe.web3-unity/Tests/Runtime/SampleTestsBase.cs index bd89a9d74..6765d4058 100644 --- a/Packages/io.chainsafe.web3-unity/Tests/Runtime/SampleTestsBase.cs +++ b/Packages/io.chainsafe.web3-unity/Tests/Runtime/SampleTestsBase.cs @@ -44,13 +44,10 @@ public virtual IEnumerator TearDown() internal static ValueTask BuildTestWeb3(Web3Builder.ConfigureServicesDelegate customConfiguration = null) { - // Set project config, fallback is for github as it doesn't load - var projectConfigScriptableObject = ProjectConfigUtilities.Load(); - if (projectConfigScriptableObject == null) - { - projectConfigScriptableObject = ProjectConfigUtilities.Create("3dc3e125-71c4-4511-a367-e981a6a94371", "11155111", - "Ethereum", "Sepolia", "Seth", "https://sepolia.infura.io/v3/287318045c6e455ab34b81d6bcd7a65f", "https://sepolia.etherscan.io/", false, "wss://sepolia.drpc.org"); - } + var projectConfigScriptableObject = ProjectConfigUtilities.Create("3dc3e125-71c4-4511-a367-e981a6a94371", + "11155111", + "Ethereum", "Sepolia", "Seth", "https://sepolia.infura.io/v3/287318045c6e455ab34b81d6bcd7a65f", + "https://sepolia.etherscan.io/", false, "wss://sepolia.drpc.org"); // Create web3builder & assign services var web3Builder = new Web3Builder(projectConfigScriptableObject).Configure(services => diff --git a/src/ChainSafe.Gaming.Unity/UnityHttpClient.cs b/src/ChainSafe.Gaming.Unity/UnityHttpClient.cs index 0cf279fc4..95c7b1f78 100644 --- a/src/ChainSafe.Gaming.Unity/UnityHttpClient.cs +++ b/src/ChainSafe.Gaming.Unity/UnityHttpClient.cs @@ -32,11 +32,20 @@ public UnityHttpClient(IMainThreadRunner mainThreadRunner) /// Converted Network Response. private static NetworkResponse UnityWebRequestToNetworkResponse(UnityWebRequest request) { - Assert.AreNotEqual(request.result, UnityWebRequest.Result.InProgress); - - if (request.result != UnityWebRequest.Result.Success) + // Assert response is successful { - throw new Web3Exception($"HTTP.{request.method} to {request.url} responded with error: {request.downloadHandler.text}"); + Assert.AreNotEqual(UnityWebRequest.Result.InProgress, request.result); + + if (request.result == UnityWebRequest.Result.ConnectionError) + { + throw new Web3Exception($"HTTP.{request.method} to '{request.url}' - connection error."); + } + + if (request.result != UnityWebRequest.Result.Success) + { + throw new Web3Exception( + $"HTTP.{request.method} to '{request.url}' responded with error: {request.downloadHandler.text}"); + } } return NetworkResponse.Success(request.downloadHandler.text);