This commit is contained in:
@@ -264,7 +264,14 @@ namespace AyaNova.Api.Controllers
|
|||||||
}
|
}
|
||||||
catch (System.Exception ex)
|
catch (System.Exception ex)
|
||||||
{
|
{
|
||||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.API_SERVER_ERROR, null, ex.Message));
|
//Don't send the full stack trace, just the initial error message from the javascript eval
|
||||||
|
// "Evaluation failed: ReferenceError: reportdata is not defined\n at reportPreRender (<anonymous>:5:17)\n at ayPreRender (C:\\data\\code\\raven\\server\\AyaNova\\resource\\rpt\\ay-report.js:13:12)\n at __puppeteer_evaluation_script__:10:25"
|
||||||
|
var v = ex.Message;
|
||||||
|
int positionOfNewLine = v.IndexOf("\n at");
|
||||||
|
if (positionOfNewLine >= 0)
|
||||||
|
v = v.Substring(0, positionOfNewLine);
|
||||||
|
|
||||||
|
return BadRequest(new ApiErrorResponse(ApiErrorCode.INVALID_OPERATION, null, v));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -330,6 +330,8 @@ namespace AyaNova.Biz
|
|||||||
log.LogDebug($"Launching headless Chrome now:");
|
log.LogDebug($"Launching headless Chrome now:");
|
||||||
using (var browser = await Puppeteer.LaunchAsync(lo))
|
using (var browser = await Puppeteer.LaunchAsync(lo))
|
||||||
using (var page = await browser.NewPageAsync())
|
using (var page = await browser.NewPageAsync())
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
log.LogDebug($"Preparing page: adding base reporting scripts to page");
|
log.LogDebug($"Preparing page: adding base reporting scripts to page");
|
||||||
|
|
||||||
@@ -379,6 +381,12 @@ namespace AyaNova.Biz
|
|||||||
await page.PdfAsync(outputFullPath);
|
await page.PdfAsync(outputFullPath);
|
||||||
log.LogDebug($"returning results now:");
|
log.LogDebug($"returning results now:");
|
||||||
return outputFileName;
|
return outputFileName;
|
||||||
|
}
|
||||||
|
catch (System.Exception ex)
|
||||||
|
{
|
||||||
|
// var v=await page.GetContentAsync();
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user