mirror of https://github.com/nodejs/node.git
repl: remove unused catch bindings
PR-URL: https://github.com/nodejs/node/pull/24079 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Wyatt Preul <wpreul@gmail.com>pull/24079/head
parent
ab14ad1f9d
commit
a7ba5faaf5
16
lib/repl.js
16
lib/repl.js
|
@ -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?
|
||||
|
@ -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++) {
|
||||
|
@ -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++) {
|
||||
|
@ -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
|
||||
|
@ -1185,7 +1185,7 @@ function complete(line, callback) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
} catch {}
|
||||
}
|
||||
|
||||
if (memberGroups.length) {
|
||||
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue