Skip to content

Commit 213b629

Browse files
cjihrigtargos
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 52468b3 commit 213b629

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/repl.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const kContextId = Symbol('contextId');
108108
try {
109109
// Hack for require.resolve("./relative") to work properly.
110110
module.filename = path.resolve('repl');
111-
} catch (e) {
111+
} catch {
112112
// path.resolve('repl') fails when the current working directory has been
113113
// deleted. Fall back to the directory name of the (absolute) executable
114114
// path. It's not really correct but what are the alternatives?
@@ -1051,7 +1051,7 @@ function complete(line, callback) {
10511051
dir = path.resolve(paths[i], subdir);
10521052
try {
10531053
files = fs.readdirSync(dir);
1054-
} catch (e) {
1054+
} catch {
10551055
continue;
10561056
}
10571057
for (f = 0; f < files.length; f++) {
@@ -1065,14 +1065,14 @@ function complete(line, callback) {
10651065
abs = path.resolve(dir, name);
10661066
try {
10671067
isDirectory = fs.statSync(abs).isDirectory();
1068-
} catch (e) {
1068+
} catch {
10691069
continue;
10701070
}
10711071
if (isDirectory) {
10721072
group.push(subdir + name + '/');
10731073
try {
10741074
subfiles = fs.readdirSync(abs);
1075-
} catch (e) {
1075+
} catch {
10761076
continue;
10771077
}
10781078
for (s = 0; s < subfiles.length; s++) {
@@ -1154,13 +1154,13 @@ function complete(line, callback) {
11541154
});
11551155
}
11561156
} else {
1157-
const evalExpr = `try { ${expr} } catch (e) {}`;
1157+
const evalExpr = `try { ${expr} } catch {}`;
11581158
this.eval(evalExpr, this.context, 'repl', (e, obj) => {
11591159
if (obj != null) {
11601160
if (typeof obj === 'object' || typeof obj === 'function') {
11611161
try {
11621162
memberGroups.push(filteredOwnPropertyNames.call(this, obj));
1163-
} catch (ex) {
1163+
} catch {
11641164
// Probably a Proxy object without `getOwnPropertyNames` trap.
11651165
// We simply ignore it here, as we don't want to break the
11661166
// autocompletion. Fixes the bug
@@ -1185,7 +1185,7 @@ function complete(line, callback) {
11851185
break;
11861186
}
11871187
}
1188-
} catch (e) {}
1188+
} catch {}
11891189
}
11901190

11911191
if (memberGroups.length) {
@@ -1458,7 +1458,7 @@ function defineDefaultCommands(repl) {
14581458
try {
14591459
fs.writeFileSync(file, this.lines.join('\n') + '\n');
14601460
this.outputStream.write('Session saved to: ' + file + '\n');
1461-
} catch (e) {
1461+
} catch {
14621462
this.outputStream.write('Failed to save: ' + file + '\n');
14631463
}
14641464
this.displayPrompt();

0 commit comments

Comments
 (0)