Skip to content

Commit a35bcd5

Browse files
cjihrigtargos
authored andcommitted
test: remove unused catch bindings
PR-URL: #24079 Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Wyatt Preul <[email protected]>
1 parent 213b629 commit a35bcd5

30 files changed

+57
-57
lines changed

test/common/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ function canCreateSymLink() {
372372
try {
373373
const output = execSync(`${whoamiPath} /priv`, { timout: 1000 });
374374
return output.includes('SeCreateSymbolicLinkPrivilege');
375-
} catch (e) {
375+
} catch {
376376
return false;
377377
}
378378
}
@@ -456,7 +456,7 @@ function isAlive(pid) {
456456
try {
457457
process.kill(pid, 'SIGCONT');
458458
return true;
459-
} catch (e) {
459+
} catch {
460460
return false;
461461
}
462462
}
@@ -665,7 +665,7 @@ function getTTYfd() {
665665
if (ttyFd === undefined) {
666666
try {
667667
return fs.openSync('/dev/tty');
668-
} catch (e) {
668+
} catch {
669669
// There aren't any tty fd's available to use.
670670
return -1;
671671
}
@@ -679,7 +679,7 @@ function runWithInvalidFD(func) {
679679
// be an valid one.
680680
try {
681681
while (fs.fstatSync(fd--) && fd > 0);
682-
} catch (e) {
682+
} catch {
683683
return func(fd);
684684
}
685685

test/doctool/test-doctool-html.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const common = require('../common');
44
// The doctool currently uses js-yaml from the tool/node_modules/eslint/ tree.
55
try {
66
require('../../tools/node_modules/eslint/node_modules/js-yaml');
7-
} catch (e) {
7+
} catch {
88
common.skip('missing js-yaml (eslint not present)');
99
}
1010

test/doctool/test-doctool-json.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const common = require('../common');
44
// The doctool currently uses js-yaml from the tool/node_modules/eslint/ tree.
55
try {
66
require('../../tools/node_modules/eslint/node_modules/js-yaml');
7-
} catch (e) {
7+
} catch {
88
common.skip('missing js-yaml (eslint not present)');
99
}
1010

test/fixtures/catch-stdout-error.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
function write() {
2323
try {
2424
process.stdout.write('Hello, world\n');
25-
} catch (ex) {
25+
} catch {
2626
throw new Error('this should never happen');
2727
}
2828
setImmediate(function() {

test/internet/test-dgram-broadcast-multi-process.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ if (process.argv[2] !== 'child') {
182182
const buf = messages[i++];
183183

184184
if (!buf) {
185-
try { sendSocket.close(); } catch (e) {}
185+
try { sendSocket.close(); } catch {}
186186
return;
187187
}
188188

test/internet/test-dgram-multicast-multi-process.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ if (process.argv[2] !== 'child') {
170170
const buf = messages[i++];
171171

172172
if (!buf) {
173-
try { sendSocket.close(); } catch (e) {}
173+
try { sendSocket.close(); } catch {}
174174
return;
175175
}
176176

test/known_issues/test-url-parse-conformance.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ tests.forEach((test) => {
4040
assert.strictEqual(test.pathname, parsed.pathname || '/');
4141
assert.strictEqual(test.search, parsed.search || '');
4242
assert.strictEqual(test.hash, parsed.hash || '');
43-
} catch (err) {
43+
} catch {
4444
// For now, we're just interested in the number of failures.
4545
failed++;
4646
}
4747
}
48-
} catch (err) {
48+
} catch {
4949
// If Parse failed and it wasn't supposed to, treat it as a failure.
5050
if (!test.failure)
5151
failed++;

test/message/vm_dont_display_runtime_error.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ try {
3030
filename: 'test.vm',
3131
displayErrors: false
3232
});
33-
} catch (e) {}
33+
} catch {}
3434

3535
console.error('middle');
3636

test/message/vm_dont_display_syntax_error.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ try {
3030
filename: 'test.vm',
3131
displayErrors: false
3232
});
33-
} catch (e) {}
33+
} catch {}
3434

3535
console.error('middle');
3636

test/parallel/test-assert.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ assert.throws(
168168
},
169169
Array
170170
);
171-
} catch (e) {
171+
} catch {
172172
threw = true;
173173
}
174174
assert.ok(threw, 'wrong constructor validation');

0 commit comments

Comments
 (0)