From b1cd13a557115c92f13d79fe46e16d4e267e4f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Ben=C3=AD=C4=8Dek?= Date: Sat, 16 Dec 2023 12:02:49 +0100 Subject: [PATCH] Small update --- Main/ApiClient.cs | 10 +++++----- RTD8TM/RTD8TM.cs | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Main/ApiClient.cs b/Main/ApiClient.cs index 8c48cc5..e33e72e 100644 --- a/Main/ApiClient.cs +++ b/Main/ApiClient.cs @@ -22,15 +22,15 @@ namespace Wrapper_Api_SequentMicrosystems.Main /// Error message public async Task GetData(string Endpoint) { - HttpResponseMessage response = await _httpClient.GetAsync(Endpoint); + string response = await _httpClient.GetStringAsync(Endpoint); - if (response.IsSuccessStatusCode) + try { - return JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); + return JsonConvert.DeserializeObject(response);//await response.Content.ReadAsStringAsync()); } - else + catch (Exception ex) { } { - throw new Exception(response.EnsureSuccessStatusCode().Content.ToString()); + throw new Exception("GetData deserialize error"); } } diff --git a/RTD8TM/RTD8TM.cs b/RTD8TM/RTD8TM.cs index b1cb7f8..178ab8b 100644 --- a/RTD8TM/RTD8TM.cs +++ b/RTD8TM/RTD8TM.cs @@ -31,14 +31,14 @@ namespace Wrapper_Api_SequentMicrosystems.RTD8TM /// Deserialized data from API public async Task> Get(string address) { - try - { + //try + //{ return await _client.GetData>($"{address}api/RTDDA"); - } - catch //(Exception ex) - { - return new(); - } + //} + //catch (Exception ex) + //{ + // throw new Exception(ex.Message); + //} } ///