Skip to content

Commit b407c6c

Browse files
not-my-profileZidiousstraker
authored
fix(cli): improve error message on script timeout (#681)
Co-authored-by: Gabe <[email protected]> Co-authored-by: Steven Lambert <[email protected]>
1 parent ada5d28 commit b407c6c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

packages/cli/src/bin/index.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
import axeTestUrls from '../lib/axe-test-urls';
1616
import event from '../lib/events';
1717
import { startDriver } from '../lib/webdriver';
18+
import { error as selenium_error } from 'selenium-webdriver';
1819

1920
const cli = async (
2021
args: OptionValues,
@@ -108,8 +109,19 @@ const cli = async (
108109
rules,
109110
disable
110111
};
112+
let outcome;
111113
try {
112-
const outcome = await axeTestUrls(urls, testPageConfigParams, events);
114+
try {
115+
outcome = await axeTestUrls(urls, testPageConfigParams, events);
116+
} catch (e) {
117+
if (e instanceof selenium_error.ScriptTimeoutError) {
118+
console.error(error('Error: %s'), e.message);
119+
console.log(`The timeout is currently configured to be ${timeout} seconds (you can change it with --timeout).`)
120+
process.exit(2);
121+
} else {
122+
throw e;
123+
}
124+
}
113125
if (silentMode) {
114126
process.stdout.write(JSON.stringify(outcome, null, 2));
115127
return;

0 commit comments

Comments
 (0)