chore: address review comments

This commit is contained in:
Marc Durdin 2023-08-09 15:35:33 +07:00
parent fa19eea873
commit 0692b8200a
2 changed files with 10 additions and 4 deletions

View file

@ -4,6 +4,12 @@ import Sentry from "@sentry/node";
import KEYMAN_VERSION from "@keymanapp/keyman-version";
import { spawnChild } from "./spawnAwait.js";
/**
* Maximum delay on shutdown of process to send pending events
* to Sentry, in msec
*/
const CLOSE_TIMEOUT = 2000;
const cli = process.argv.join(' ');
let isInit = false;
@ -39,7 +45,7 @@ export class KeymanSentry {
}
} else if(cli.includes('event')) {
const eventId = Sentry.captureMessage('Test message from -sentry-client-test-exception event');
await Sentry.close(2000);
await Sentry.close(CLOSE_TIMEOUT);
console.log(`Captured test message with id ${eventId}`);
process.exit(0);
} else {

View file

@ -122,11 +122,11 @@ export class NodeCompilerCallbacks implements CompilerCallbacks {
this.messages.push({...event});
// report fatal errors to Sentry, but don't display; note, it won't be
// report fatal errors to Sentry, but don't abort; note, it won't be
// reported if user has disabled the Sentry setting
if(CompilerError.severity(event.code) == CompilerErrorSeverity.Fatal) {
// this is async so returns a Promise, we'll let it resolve
// in its own time, and it can print its message then
// this is async so returns a Promise, we'll let it resolve in its own
// time, and it will emit a message to stderr with details at that time
KeymanSentry.reportException(event.exceptionVar, false);
}