case 4586 - got to build point without error all dependencies updated but reporting error handling work to be done and not tested at all yet

This commit is contained in:
2024-05-10 00:09:48 +00:00
parent 87a4946500
commit 557241b0e5

View File

@@ -11,6 +11,7 @@ using EnumsNET;
using PuppeteerSharp;
using Newtonsoft.Json.Linq;
using System;
using StackExchange.Profiling.Internal;
namespace AyaNova.Biz
{
@@ -570,7 +571,8 @@ namespace AyaNova.Biz
else
{
log.LogDebug($"Windows: Calling browserFetcher download async now:");
await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultChromiumRevision);
//await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultChromiumRevision);
await new BrowserFetcher(SupportedBrowser.Chromium).DownloadAsync();
}
@@ -611,15 +613,20 @@ namespace AyaNova.Biz
try
{
//info and error logging
page.Console += async (sender, args) =>
//case 4586 not calling task whenall now means non async so this page.Console += async (sender, args) => is now this:
page.Console += (sender, args) =>
{
switch (args.Message.Type)
{
case ConsoleType.Error:
try
{
var errorArgs = await Task.WhenAll(args.Message.Args.Select(arg => arg.ExecutionContext.EvaluateFunctionAsync("(arg) => arg instanceof Error ? arg.message : arg", arg)));
PageLog.AppendLine($"ERROR: {args.Message.Text} args: [{string.Join<object>(", ", errorArgs)}]");
//case 4586 todo force an error here and see what we can do with it old vs new behaviour test on current release same report with erorr triggered
PageLog.AppendLine($"ERROR: {args.Message.Text}");
//case 4586 this no longer works due to no executioncontext in arg in teh block below
// var errorArgs = await Task.WhenAll(args.Message.Args.Select(arg => arg.ExecutionContext.EvaluateFunctionAsync("(arg) => arg instanceof Error ? arg.message : arg", arg)));
// PageLog.AppendLine($"ERROR: {args.Message.Text} args: [{string.Join<object>(", ", errorArgs)}]");
}
catch { }
break;