Skip to content

Commit 14f58df

Browse files
Merge pull request #2107 from github/revert-2076-robertbrignull/unhandled_rejection
Revert "Add unhandled rejection listener"
2 parents 7b4b491 + c712b06 commit 14f58df

File tree

1 file changed

+0
-30
lines changed

1 file changed

+0
-30
lines changed

extensions/ql-vscode/src/extension.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ export async function activate(
234234
const distributionConfigListener = new DistributionConfigListener();
235235
await initializeLogging(ctx);
236236
await initializeTelemetry(extension, ctx);
237-
addUnhandledRejectionListener();
238237
install();
239238

240239
const codelensProvider = new QuickEvalCodeLensProvider();
@@ -1526,35 +1525,6 @@ async function activateWithInstalledDistribution(
15261525
};
15271526
}
15281527

1529-
function addUnhandledRejectionListener() {
1530-
const handler = (error: unknown) => {
1531-
const message = redactableError(
1532-
asError(error),
1533-
)`Unhandled error: ${getErrorMessage(error)}`;
1534-
// Add a catch so that showAndLogExceptionWithTelemetry fails, we avoid
1535-
// triggering "unhandledRejection" and avoid an infinite loop
1536-
showAndLogExceptionWithTelemetry(message).catch(
1537-
(telemetryError: unknown) => {
1538-
void extLogger.log(
1539-
`Failed to send error telemetry: ${getErrorMessage(telemetryError)}`,
1540-
);
1541-
void extLogger.log(message.fullMessage);
1542-
},
1543-
);
1544-
};
1545-
1546-
// "uncaughtException" will trigger whenever an exception reaches the top level.
1547-
// This covers extension initialization and any code within a `setTimeout`.
1548-
// Notably this does not include exceptions thrown when executing commands,
1549-
// because `commandRunner` wraps the command body and handles errors.
1550-
process.addListener("uncaughtException", handler);
1551-
1552-
// "unhandledRejection" will trigger whenever any promise is rejected and it is
1553-
// not handled by a "catch" somewhere in the promise chain. This includes when
1554-
// a promise is used with the "void" operator.
1555-
process.addListener("unhandledRejection", handler);
1556-
}
1557-
15581528
async function createQueryServer(
15591529
qlConfigurationListener: QueryServerConfigListener,
15601530
cliServer: CodeQLCliServer,

0 commit comments

Comments
 (0)