(core) Improve debug logging related for client-side errors and sandbox crashes.

Summary:
- Include docId when available for client-side error reporting
- Distinguish sandbox crashes from forced exits

Test Plan: Tested manually

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D3373
This commit is contained in:
Dmitry S
2022-04-11 09:52:34 -04:00
parent 859c593448
commit cedcdc6bff
3 changed files with 9 additions and 1 deletions

View File

@@ -177,11 +177,13 @@ export function setUpErrorHandling(doReportError = reportError, koUtil?: any) {
*/
function _logError(error: Error|string) {
if (!pageHasHome()) { return; }
const docId = G.window.gristDocPageModel?.currentDocId?.get();
fetchFromHome('/api/log', {
method: 'POST',
body: JSON.stringify({
// Errors don't stringify, so pick out properties explicitly for errors.
event: (error instanceof Error) ? pick(error, Object.getOwnPropertyNames(error)) : error,
docId,
page: G.window.location.href,
browser: pick(G.window.navigator, ['language', 'platform', 'userAgent'])
}),