Merge VS Code 1.31.1 (#4283)

This commit is contained in:
Matt Irvine
2019-03-15 13:09:45 -07:00
committed by GitHub
parent 7d31575149
commit 86bac90001
1716 changed files with 53308 additions and 48375 deletions

View File

@@ -3,59 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { TPromise, IPromiseError, IPromiseErrorDetail } from 'vs/base/common/winjs.base';
// ------ BEGIN Hook up error listeners to winjs promises
let outstandingPromiseErrors: { [id: string]: IPromiseErrorDetail; } = {};
function promiseErrorHandler(e: IPromiseError): void {
//
// e.detail looks like: { exception, error, promise, handler, id, parent }
//
const details = e.detail;
const id = details.id;
// If the error has a parent promise then this is not the origination of the
// error so we check if it has a handler, and if so we mark that the error
// was handled by removing it from outstandingPromiseErrors
//
if (details.parent) {
if (details.handler && outstandingPromiseErrors) {
delete outstandingPromiseErrors[id];
}
return;
}
// Indicate that this error was originated and needs to be handled
outstandingPromiseErrors[id] = details;
// The first time the queue fills up this iteration, schedule a timeout to
// check if any errors are still unhandled.
if (Object.keys(outstandingPromiseErrors).length === 1) {
setTimeout(function () {
const errors = outstandingPromiseErrors;
outstandingPromiseErrors = {};
Object.keys(errors).forEach(function (errorId) {
const error = errors[errorId];
if (error.exception) {
onUnexpectedError(error.exception);
} else if (error.error) {
onUnexpectedError(error.error);
}
console.log('WARNING: Promise with no error callback:' + error.id);
console.log(error);
if (error.exception) {
console.log(error.exception.stack);
}
});
}, 0);
}
}
TPromise.addEventListener('error', promiseErrorHandler);
// ------ END Hook up error listeners to winjs promises
export interface ErrorListenerCallback {
(error: any): void;
}