Skip to content

Commit bbd38ea

Browse files
cjihrigcodebytere
authored andcommitted
repl: remove unused catch bindings
PR-URL: #24079 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Wyatt Preul <wpreul@gmail.com>
1 parent 0b42564 commit bbd38ea

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/repl.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const kContextId = Symbol('contextId');
107107
try {
108108
// Hack for require.resolve("./relative") to work properly.
109109
module.filename = path.resolve('repl');
110-
} catch (e) {
110+
} catch {
111111
// path.resolve('repl') fails when the current working directory has been
112112
// deleted. Fall back to the directory name of the (absolute) executable
113113
// path. It's not really correct but what are the alternatives?
@@ -1046,7 +1046,7 @@ function complete(line, callback) {
10461046
dir = path.resolve(paths[i], subdir);
10471047
try {
10481048
files = fs.readdirSync(dir);
1049-
} catch (e) {
1049+
} catch {
10501050
continue;
10511051
}
10521052
for (f = 0; f < files.length; f++) {
@@ -1060,14 +1060,14 @@ function complete(line, callback) {
10601060
abs = path.resolve(dir, name);
10611061
try {
10621062
isDirectory = fs.statSync(abs).isDirectory();
1063-
} catch (e) {
1063+
} catch {
10641064
continue;
10651065
}
10661066
if (isDirectory) {
10671067
group.push(subdir + name + '/');
10681068
try {
10691069
subfiles = fs.readdirSync(abs);
1070-
} catch (e) {
1070+
} catch {
10711071
continue;
10721072
}
10731073
for (s = 0; s < subfiles.length; s++) {
@@ -1149,13 +1149,13 @@ function complete(line, callback) {
11491149
});
11501150
}
11511151
} else {
1152-
const evalExpr = `try { ${expr} } catch (e) {}`;
1152+
const evalExpr = `try { ${expr} } catch {}`;
11531153
this.eval(evalExpr, this.context, 'repl', (e, obj) => {
11541154
if (obj != null) {
11551155
if (typeof obj === 'object' || typeof obj === 'function') {
11561156
try {
11571157
memberGroups.push(filteredOwnPropertyNames.call(this, obj));
1158-
} catch (ex) {
1158+
} catch {
11591159
// Probably a Proxy object without `getOwnPropertyNames` trap.
11601160
// We simply ignore it here, as we don't want to break the
11611161
// autocompletion. Fixes the bug
@@ -1180,7 +1180,7 @@ function complete(line, callback) {
11801180
break;
11811181
}
11821182
}
1183-
} catch (e) {}
1183+
} catch {}
11841184
}
11851185

11861186
if (memberGroups.length) {
@@ -1453,7 +1453,7 @@ function defineDefaultCommands(repl) {
14531453
try {
14541454
fs.writeFileSync(file, this.lines.join('\n') + '\n');
14551455
this.outputStream.write('Session saved to: ' + file + '\n');
1456-
} catch (e) {
1456+
} catch {
14571457
this.outputStream.write('Failed to save: ' + file + '\n');
14581458
}
14591459
this.displayPrompt();

0 commit comments

Comments
 (0)