mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-01-18 21:32:27 +01:00
Catch error with bitflyer
This commit is contained in:
parent
c633402fe2
commit
5565d8dae5
@ -21,6 +21,10 @@ namespace BTCPayServer.Services.Rates
|
|||||||
{
|
{
|
||||||
var response = await _httpClient.GetAsync("https://api.bitflyer.jp/v1/ticker", cancellationToken);
|
var response = await _httpClient.GetAsync("https://api.bitflyer.jp/v1/ticker", cancellationToken);
|
||||||
var jobj = await response.Content.ReadAsAsync<JObject>(cancellationToken);
|
var jobj = await response.Content.ReadAsAsync<JObject>(cancellationToken);
|
||||||
|
if (jobj.Property("error_message")?.Value?.Value<string>() is string err)
|
||||||
|
{
|
||||||
|
throw new Exception($"Error from bitflyer: {err}");
|
||||||
|
}
|
||||||
var bid = jobj.Property("best_bid").Value.Value<decimal>();
|
var bid = jobj.Property("best_bid").Value.Value<decimal>();
|
||||||
var ask = jobj.Property("best_ask").Value.Value<decimal>();
|
var ask = jobj.Property("best_ask").Value.Value<decimal>();
|
||||||
var rates = new PairRate[1];
|
var rates = new PairRate[1];
|
||||||
|
Loading…
Reference in New Issue
Block a user