Skip to content

Commit 60532e1

Browse files
Add unhandled rejection listener
1 parent 851a42f commit 60532e1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

extensions/ql-vscode/src/extension.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ export async function activate(
236236
const distributionConfigListener = new DistributionConfigListener();
237237
await initializeLogging(ctx);
238238
await initializeTelemetry(extension, ctx);
239+
addUnhandledRejectionListener();
239240
install();
240241

241242
const codelensProvider = new QuickEvalCodeLensProvider();
@@ -1529,6 +1530,16 @@ async function activateWithInstalledDistribution(
15291530
};
15301531
}
15311532

1533+
function addUnhandledRejectionListener() {
1534+
process.addListener("unhandledRejection", (error: unknown) => {
1535+
void showAndLogExceptionWithTelemetry(
1536+
redactableError(asError(error))`Unhandled error: ${getErrorMessage(
1537+
error,
1538+
)}`,
1539+
);
1540+
});
1541+
}
1542+
15321543
async function createQueryServer(
15331544
qlConfigurationListener: QueryServerConfigListener,
15341545
cliServer: CodeQLCliServer,

0 commit comments

Comments
 (0)