mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-25 20:57:12 +00:00
cli - handle unhandled errors (fix #128854)
This commit is contained in:
@@ -42,7 +42,7 @@ import { ExtensionManagementCLIService } from 'vs/platform/extensionManagement/c
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { LocalizationsService } from 'vs/platform/localizations/node/localizations';
|
||||
import { ILocalizationsService } from 'vs/platform/localizations/common/localizations';
|
||||
import { setUnexpectedErrorHandler } from 'vs/base/common/errors';
|
||||
import { onUnexpectedError, setUnexpectedErrorHandler } from 'vs/base/common/errors';
|
||||
import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||
import { VSBuffer } from 'vs/base/common/buffer';
|
||||
import { cwd } from 'vs/base/common/process';
|
||||
@@ -189,6 +189,10 @@ class CliMain extends Disposable {
|
||||
|
||||
logService.error(`[uncaught exception in CLI]: ${message}`);
|
||||
});
|
||||
|
||||
// Handle unhandled errors that can occur
|
||||
process.on('uncaughtException', err => onUnexpectedError(err));
|
||||
process.on('unhandledRejection', (reason: unknown) => onUnexpectedError(reason));
|
||||
}
|
||||
|
||||
private async doRun(environmentService: INativeEnvironmentService, extensionManagementCLIService: IExtensionManagementCLIService, fileService: IFileService): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user