Skip to content

Commit 80d7a82

Browse files
Improve blockchair returned error
1 parent b99916e commit 80d7a82

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

WatchOnlyBitcoinWallet/Services/BalanceServices/Blockchair.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,20 @@ public async Task<Response> UpdateBalancesAsync(List<BitcoinAddress> addrList)
2424
Response<JObject> apiResp = await SendApiRequestAsync(url);
2525
if (!apiResp.IsSuccess)
2626
{
27-
resp.Error = apiResp.Error;
27+
if (apiResp.Error.Contains("402") || apiResp.Error.Contains("429")|| apiResp.Error.Contains("435"))
28+
{
29+
resp.Error = "You've exceeded blockchair's limit. " +
30+
"Select a different API service in settings window.";
31+
}
32+
else if (apiResp.Error.Contains("430") || apiResp.Error.Contains("434") || apiResp.Error.Contains("503"))
33+
{
34+
resp.Error = "Blockchair blacklisted your IP! " +
35+
"Change your IP address or select a different API service in settings window.";
36+
}
37+
else
38+
{
39+
resp.Error = apiResp.Error;
40+
}
2841
return resp;
2942
}
3043
Debug.Assert(apiResp.Result is not null);

WatchOnlyBitcoinWallet/WatchOnlyBitcoinWallet.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<TargetFramework>net8.0</TargetFramework>
55
<OutputType>WinExe</OutputType>
66
<Nullable>enable</Nullable>
7-
<FileVersion>4.0.0</FileVersion>
8-
<AssemblyVersion>4.0.0</AssemblyVersion>
7+
<FileVersion>4.0.1</FileVersion>
8+
<AssemblyVersion>4.0.1</AssemblyVersion>
99
<ApplicationIcon>Assets\myICO.ico</ApplicationIcon>
1010
</PropertyGroup>
1111

0 commit comments

Comments
 (0)