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 <vieuxtech@gmail.com>
Reviewed-By: Wyatt Preul <wpreul@gmail.com>
  • Loading branch information
cjihrig authored and targos committed Nov 6, 2018
1 parent 52468b3 commit 213b629
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 @@ -108,7 +108,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 @@ -1051,7 +1051,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 @@ -1065,14 +1065,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 @@ -1154,13 +1154,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 @@ -1185,7 +1185,7 @@ function complete(line, callback) {
break;
}
}
} catch (e) {}
} catch {}
}

if (memberGroups.length) {
Expand Down Expand Up @@ -1458,7 +1458,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 213b629

Please sign in to comment.