Skip to content

Commit

Permalink
repl: remove unused catch bindings
Browse files Browse the repository at this point in the history
PR-URL: #24079
Reviewed-By: Sam Roberts <[email protected]>
Reviewed-By: Wyatt Preul <[email protected]>
  • Loading branch information
cjihrig authored and MylesBorins committed Dec 3, 2018
1 parent 8001bee commit 4b456d5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const kContextId = Symbol('contextId');
try {
// Hack for require.resolve("./relative") to work properly.
module.filename = path.resolve('repl');
} catch (e) {
} catch {
// path.resolve('repl') fails when the current working directory has been
// deleted. Fall back to the directory name of the (absolute) executable
// path. It's not really correct but what are the alternatives?
Expand Down Expand Up @@ -1046,7 +1046,7 @@ function complete(line, callback) {
dir = path.resolve(paths[i], subdir);
try {
files = fs.readdirSync(dir);
} catch (e) {
} catch {
continue;
}
for (f = 0; f < files.length; f++) {
Expand All @@ -1060,14 +1060,14 @@ function complete(line, callback) {
abs = path.resolve(dir, name);
try {
isDirectory = fs.statSync(abs).isDirectory();
} catch (e) {
} catch {
continue;
}
if (isDirectory) {
group.push(subdir + name + '/');
try {
subfiles = fs.readdirSync(abs);
} catch (e) {
} catch {
continue;
}
for (s = 0; s < subfiles.length; s++) {
Expand Down Expand Up @@ -1149,13 +1149,13 @@ function complete(line, callback) {
});
}
} else {
const evalExpr = `try { ${expr} } catch (e) {}`;
const evalExpr = `try { ${expr} } catch {}`;
this.eval(evalExpr, this.context, 'repl', (e, obj) => {
if (obj != null) {
if (typeof obj === 'object' || typeof obj === 'function') {
try {
memberGroups.push(filteredOwnPropertyNames.call(this, obj));
} catch (ex) {
} catch {
// Probably a Proxy object without `getOwnPropertyNames` trap.
// We simply ignore it here, as we don't want to break the
// autocompletion. Fixes the bug
Expand All @@ -1180,7 +1180,7 @@ function complete(line, callback) {
break;
}
}
} catch (e) {}
} catch {}
}

if (memberGroups.length) {
Expand Down Expand Up @@ -1453,7 +1453,7 @@ function defineDefaultCommands(repl) {
try {
fs.writeFileSync(file, this.lines.join('\n') + '\n');
this.outputStream.write('Session saved to: ' + file + '\n');
} catch (e) {
} catch {
this.outputStream.write('Failed to save: ' + file + '\n');
}
this.displayPrompt();
Expand Down

0 comments on commit 4b456d5

Please sign in to comment.