call api 관련 Error 소

This commit is contained in:
kyh
2024-01-17 15:27:45 +09:00
parent 96ee504102
commit 660579891c

View File

@@ -1,4 +1,7 @@
using System;
using Million.Manager;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IdentityModel.Tokens.Jwt;
@@ -45,20 +48,27 @@ namespace Million.WebMangement.Upbit
requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", CreateJwt(nvc));
}
try
{
var response = httpClient.SendAsync(requestMessage).Result;
var response = httpClient.SendAsync(requestMessage).Result;
if (response.Headers.Contains("Date"))
{
time = response.Headers.Date.Value.LocalDateTime;
if (response.Headers.Contains("Date"))
{
time = response.Headers.Date.Value.LocalDateTime;
}
else
{
time = DateTime.Now;
}
var contents = response.Content.ReadAsStringAsync().Result;
return contents;
}
else
{
catch(Exception ex){
LogManager.WriteLog("DateTime : "+ DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + " API Call Error : " + ex.Message);
time = DateTime.Now;
}
var contents = response.Content.ReadAsStringAsync().Result;
return contents;
return "";
}
}
/// <summary>