Improve handling of unexpected errors in tests
This commit is contained in:
parent
94545eeeb0
commit
f4bc1c0908
1 changed files with 6 additions and 5 deletions
|
@ -155,11 +155,12 @@ function loadTests(opts) {
|
|||
// collect unexpected errors
|
||||
loader.require(['vs/base/common/errors'], function (errors) {
|
||||
errors.setUnexpectedErrorHandler(function (err) {
|
||||
try {
|
||||
throw new Error('oops');
|
||||
} catch (e) {
|
||||
_unexpectedErrors.push((err && err.message ? err.message : err) + '\n' + e.stack);
|
||||
let stack = (err ? err.stack : null);
|
||||
if (!stack) {
|
||||
stack = new Error().stack;
|
||||
}
|
||||
|
||||
_unexpectedErrors.push((err && err.message ? err.message : err) + '\n' + stack);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -172,7 +173,7 @@ function loadTests(opts) {
|
|||
console.error('');
|
||||
console.error(stack);
|
||||
});
|
||||
assert.ok(false);
|
||||
assert.ok(false, errors);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue