mirror of
https://github.com/CyberL1/MyMcRealms.git
synced 2024-11-24 15:08:22 -05:00
feat: error handling
This commit is contained in:
parent
d502f2d0f4
commit
ec4a9c286b
@ -14,16 +14,19 @@ namespace MyMcRealms.MyMcAPI
|
||||
}
|
||||
|
||||
public async Task<AllServersResponse?> GetAllServers()
|
||||
{
|
||||
try
|
||||
{
|
||||
AllServersResponse? response = await httpClient.GetFromJsonAsync<AllServersResponse>($"list_all_servers/{Environment.GetEnvironmentVariable("MYMC_SERVER_LIST_KEY")}");
|
||||
|
||||
if (response == null)
|
||||
return response;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("error while doing GET /list_all_servers");
|
||||
Console.WriteLine(e.Message);
|
||||
return null;
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
public HttpResponseMessage? ExecuteCommand(string command)
|
||||
|
Loading…
Reference in New Issue
Block a user