mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(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:
parent
859c593448
commit
cedcdc6bff
@ -177,11 +177,13 @@ export function setUpErrorHandling(doReportError = reportError, koUtil?: any) {
|
|||||||
*/
|
*/
|
||||||
function _logError(error: Error|string) {
|
function _logError(error: Error|string) {
|
||||||
if (!pageHasHome()) { return; }
|
if (!pageHasHome()) { return; }
|
||||||
|
const docId = G.window.gristDocPageModel?.currentDocId?.get();
|
||||||
fetchFromHome('/api/log', {
|
fetchFromHome('/api/log', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
// Errors don't stringify, so pick out properties explicitly for errors.
|
// Errors don't stringify, so pick out properties explicitly for errors.
|
||||||
event: (error instanceof Error) ? pick(error, Object.getOwnPropertyNames(error)) : error,
|
event: (error instanceof Error) ? pick(error, Object.getOwnPropertyNames(error)) : error,
|
||||||
|
docId,
|
||||||
page: G.window.location.href,
|
page: G.window.location.href,
|
||||||
browser: pick(G.window.navigator, ['language', 'platform', 'userAgent'])
|
browser: pick(G.window.navigator, ['language', 'platform', 'userAgent'])
|
||||||
}),
|
}),
|
||||||
|
@ -576,6 +576,7 @@ export class FlexServer implements GristServer {
|
|||||||
const mreq = req as RequestWithLogin;
|
const mreq = req as RequestWithLogin;
|
||||||
log.rawWarn('client error', {
|
log.rawWarn('client error', {
|
||||||
event: req.body.event,
|
event: req.body.event,
|
||||||
|
docId: req.body.docId,
|
||||||
page: req.body.page,
|
page: req.body.page,
|
||||||
browser: req.body.browser,
|
browser: req.body.browser,
|
||||||
org: mreq.org,
|
org: mreq.org,
|
||||||
|
@ -233,8 +233,13 @@ export class NSandbox implements ISandbox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _onExit(code: number, signal: string) {
|
private _onExit(code: number, signal: string) {
|
||||||
|
const expected = this._isWriteClosed;
|
||||||
this._close();
|
this._close();
|
||||||
log.rawDebug(`Sandbox exited with code ${code} signal ${signal}`, this._logMeta);
|
if (expected) {
|
||||||
|
log.rawDebug(`Sandbox exited with code ${code} signal ${signal}`, this._logMeta);
|
||||||
|
} else {
|
||||||
|
log.rawWarn(`Sandbox unexpectedly exited with code ${code} signal ${signal}`, this._logMeta);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user