Skip to content

Commit

Permalink
chore(logging): Adds a more clear error output for invalid drivers. #393
Browse files Browse the repository at this point in the history
 (#394)
  • Loading branch information
bmsdave authored and cnishina committed Jul 31, 2019
1 parent 579a05b commit b6e6613
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/binaries/chrome_xml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ export class ChromeXml extends XmlConfigSource {
private getSpecificChromeDriverVersion(inputVersion: string): Promise<BinaryUrl> {
return this.getVersionList().then(list => {
const specificVersion = getValidSemver(inputVersion);

if (specificVersion === "") {
throw new Error(`version ${inputVersion} ChromeDriver does not exist`)
}
let itemFound = '';
for (let item of list) {
// Get a semantic version.
Expand Down
6 changes: 5 additions & 1 deletion lib/cmds/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,11 @@ function unzip<T extends Binary>(binary: T, outputDir: string, fileName: string)
// unzip the file
logger.info(binary.name + ': unzipping ' + fileName);
if (fileName.slice(-4) == '.zip') {
let zip = new AdmZip(path.resolve(outputDir, fileName));
try {
let zip = new AdmZip(path.resolve(outputDir, fileName));
} catch (e) {
throw new Error(`Invalid filename: ${path.resolve(outputDir, fileName)}`)
}
zip.extractAllTo(outputDir, true);
} else {
// We will only ever get .tar files on linux
Expand Down
2 changes: 1 addition & 1 deletion lib/files/downloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class Downloader {
});
})
.catch(error => {
logger.error((error as any).msg);
logger.error((error as any).msg || (error as any).message);
});
}
}

0 comments on commit b6e6613

Please sign in to comment.