提交 f199d20e 编写于 作者: B Benjamin Pasero

debt - more TPromise.done() removal and unhandledRejection handler (#57695)

上级 473e5051
......@@ -141,12 +141,15 @@ if (!process.env['VSCODE_ALLOW_IO']) {
}
if (!process.env['VSCODE_HANDLES_UNCAUGHT_ERRORS']) {
// Handle uncaught exceptions
process.on('uncaughtException', function (err) {
console.error('Uncaught Exception: ', err.toString());
if (err.stack) {
console.error(err.stack);
}
console.error('Uncaught Exception: ', err);
});
// Handle unhandled promise rejections
process.on('unhandledRejection', function (reason) {
console.error('Unhandled Promise Rejection: ', reason);
});
}
......
......@@ -442,7 +442,7 @@ export class CodeApplication {
const windowsService = accessor.get(IWindowsService);
const windowsChannel = new WindowsChannel(windowsService);
this.electronIpcServer.registerChannel('windows', windowsChannel);
this.sharedProcessClient.done(client => client.registerChannel('windows', windowsChannel));
this.sharedProcessClient.then(client => client.registerChannel('windows', windowsChannel));
const menubarService = accessor.get(IMenubarService);
const menubarChannel = new MenubarChannel(menubarService);
......@@ -455,7 +455,7 @@ export class CodeApplication {
// Log level management
const logLevelChannel = new LogLevelSetterChannel(accessor.get(ILogService));
this.electronIpcServer.registerChannel('loglevel', logLevelChannel);
this.sharedProcessClient.done(client => client.registerChannel('loglevel', logLevelChannel));
this.sharedProcessClient.then(client => client.registerChannel('loglevel', logLevelChannel));
// Lifecycle
this.lifecycleService.ready();
......
......@@ -312,7 +312,7 @@ export class CodeWindow implements ICodeWindow {
// Inject headers when requests are incoming
const urls = ['https://marketplace.visualstudio.com/*', 'https://*.vsassets.io/*'];
this._win.webContents.session.webRequest.onBeforeSendHeaders({ urls }, (details: any, cb: any) => {
this.marketplaceHeadersPromise.done(headers => {
this.marketplaceHeadersPromise.then(headers => {
cb({ cancel: false, requestHeaders: objects.assign(details.requestHeaders, headers) });
});
});
......
......@@ -485,7 +485,7 @@ export class WindowsManager implements IWindowsMainService {
// used for the edit operation is closed or loaded to a different folder so that the waiting
// process can continue. We do this by deleting the waitMarkerFilePath.
if (openConfig.context === OpenContext.CLI && openConfig.cli.wait && openConfig.cli.waitMarkerFilePath && usedWindows.length === 1 && usedWindows[0]) {
this.waitForWindowCloseOrLoad(usedWindows[0].id).done(() => fs.unlink(openConfig.cli.waitMarkerFilePath, error => void 0));
this.waitForWindowCloseOrLoad(usedWindows[0].id).then(() => fs.unlink(openConfig.cli.waitMarkerFilePath, error => void 0));
}
return usedWindows;
......@@ -1279,7 +1279,7 @@ export class WindowsManager implements IWindowsMainService {
}
// Only load when the window has not vetoed this
this.lifecycleService.unload(window, UnloadReason.LOAD).done(veto => {
this.lifecycleService.unload(window, UnloadReason.LOAD).then(veto => {
if (!veto) {
// Register window for backups
......@@ -1434,7 +1434,7 @@ export class WindowsManager implements IWindowsMainService {
reload(win: ICodeWindow, cli?: ParsedArgs): void {
// Only reload when the window has not vetoed this
this.lifecycleService.unload(win, UnloadReason.RELOAD).done(veto => {
this.lifecycleService.unload(win, UnloadReason.RELOAD).then(veto => {
if (!veto) {
win.reload(void 0, cli);
......
......@@ -199,7 +199,7 @@ export class LifecycleService implements ILifecycleService {
// Otherwise prevent unload and handle it from window
e.preventDefault();
this.unload(window, UnloadReason.CLOSE).done(veto => {
this.unload(window, UnloadReason.CLOSE).then(veto => {
if (!veto) {
this.windowToCloseRequest[windowId] = true;
......
......@@ -144,7 +144,7 @@ export abstract class AbstractUpdateService implements IUpdateService {
this.logService.trace('update#quitAndInstall(): before lifecycle quit()');
this.lifecycleService.quit(true /* from update */).done(vetod => {
this.lifecycleService.quit(true /* from update */).then(vetod => {
this.logService.trace(`update#quitAndInstall(): after lifecycle quit() with veto: ${vetod}`);
if (vetod) {
return;
......
......@@ -449,10 +449,10 @@ export class WorkbenchShell extends Disposable {
open(): void {
// Listen on unhandled rejection events
window.addEventListener('unhandledrejection', event => {
window.addEventListener('unhandledrejection', (event: PromiseRejectionEvent) => {
// See https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent
errors.onUnexpectedError((<any>event).reason);
errors.onUnexpectedError(event.reason);
// Prevent the printing of this event to the console
event.preventDefault();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册