not call fetched if exception errors.
This commit is contained in:
parent
c81e2ed3d6
commit
9eeef70874
|
|
@ -115,16 +115,20 @@ public class PlaywrightInstance : IDisposable
|
|||
JsonElement? json = null;
|
||||
try
|
||||
{
|
||||
json = await e.JsonAsync();
|
||||
if (e.Status == 200 && e.Ok)
|
||||
{
|
||||
json = await e.JsonAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
Serilog.Log.Warning($"Response status: {e.Status} {e.StatusText}, OK: {e.Ok}");
|
||||
}
|
||||
fetched(e.Url.ToLower(), JsonSerializer.Serialize(json));
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Serilog.Log.Error(ex.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
fetched(e.Url.ToLower(), JsonSerializer.Serialize(json ?? new JsonElement()));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue