Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
fix(launcher) Ignore uncaught exceptions from webdriver. (#3608)
Browse files Browse the repository at this point in the history
  • Loading branch information
heathkit authored Oct 10, 2016
1 parent ef72882 commit 6626ce7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,12 @@ export interface Config {
*/
untrackOutstandingTimeouts?: boolean;

/**
* If set, Protractor will ignore uncaught exceptions instead of exiting
* without an error code. The exceptions will still be logged as warnings.
*/
ignoreUncaughtExceptions?: boolean;

// ---------------------------------------------------------------------------
// ----- The test framework
// --------------------------------------------------
Expand Down
7 changes: 7 additions & 0 deletions lib/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,13 @@ let initFn = function(configFile: string, additionalConfig: Config) {

process.on('uncaughtException', (exc: (Error|string)) => {
let e = (exc instanceof Error) ? exc : new Error(exc);
if (config.ignoreUncaughtExceptions) {
// This can be a sign of a bug in the test framework, that it may
// not be handling WebDriver errors properly. However, we don't
// want these errors to prevent running the tests.
logger.warn('Ignoring uncaught error ' + exc);
return;
}

let errorCode = ErrorHandler.parseError(e);
if (errorCode) {
Expand Down

0 comments on commit 6626ce7

Please sign in to comment.