Skip to content

Commit

Permalink
Improve handling of unexpected errors in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdima committed Apr 18, 2017
1 parent 94545ee commit f4bc1c0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions test/electron/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});

Expand All @@ -172,7 +173,7 @@ function loadTests(opts) {
console.error('');
console.error(stack);
});
assert.ok(false);
assert.ok(false, errors);
}
});
});
Expand Down

0 comments on commit f4bc1c0

Please sign in to comment.