Added further parsing validation and error messages
This commit is contained in:
@@ -445,14 +445,19 @@ public class Connection
|
||||
|
||||
var parsedLogs = await response.Content.ReadFromJsonAsync<List<Dictionary<string, object>>>()
|
||||
?? throw new UserReportedException("Failed to parse response");
|
||||
|
||||
if (parsedLogs.Count < 1)
|
||||
{
|
||||
return "Failed to run";
|
||||
return "No logs available";
|
||||
}
|
||||
try
|
||||
{
|
||||
var lastLogResultString = ((JsonElement)parsedLogs[0]["Message"]).GetString();
|
||||
var lastLogResult = JsonSerializer.Deserialize<JsonElement>(lastLogResultString);
|
||||
return lastLogResult.GetProperty("ParsedResult").ToString();
|
||||
} catch
|
||||
{
|
||||
return "Failed to parse backup log";
|
||||
}
|
||||
var lastLogResultString = ((JsonElement)parsedLogs[0]["Message"]).GetString();
|
||||
var lastLogResult = JsonSerializer.Deserialize<JsonElement>(lastLogResultString);
|
||||
return lastLogResult.GetProperty("ParsedResult").ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user