Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4834be3

Browse filesBrowse files
Trottruyadorno
authored andcommitted
lib: add comments to empty catch statements
PR-URL: #41831 Refs: https://eslint.org/docs/rules/no-empty Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 8a42a20 commit 4834be3
Copy full SHA for 4834be3

File tree

Expand file treeCollapse file tree

14 files changed

+59
-19
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

14 files changed

+59
-19
lines changed
Open diff view settings
Collapse file

‎lib/events.js‎

Copy file name to clipboardExpand all lines: lib/events.js
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,9 @@ function enhanceStackTrace(err, own) {
445445
const { name } = this.constructor;
446446
if (name !== 'EventEmitter')
447447
ctorInfo = ` on ${name} instance`;
448-
} catch {}
448+
} catch {
449+
// Continue regardless of error.
450+
}
449451
const sep = `\nEmitted 'error' event${ctorInfo} at:\n`;
450452

451453
const errStack = ArrayPrototypeSlice(
@@ -493,7 +495,9 @@ EventEmitter.prototype.emit = function emit(type, ...args) {
493495
value: FunctionPrototypeBind(enhanceStackTrace, this, er, capture),
494496
configurable: true
495497
});
496-
} catch {}
498+
} catch {
499+
// Continue regardless of error.
500+
}
497501

498502
// Note: The comments on the `throw` lines are intentional, they show
499503
// up in Node's output if this results in an unhandled exception.
Collapse file

‎lib/fs.js‎

Copy file name to clipboardExpand all lines: lib/fs.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1600,7 +1600,9 @@ function symlink(target, path, type_, callback_) {
16001600
// errors consistent between platforms if invalid path is
16011601
// provided.
16021602
absoluteTarget = pathModule.resolve(path, '..', target);
1603-
} catch { }
1603+
} catch {
1604+
// Continue regardless of error.
1605+
}
16041606
if (absoluteTarget !== undefined) {
16051607
stat(absoluteTarget, (err, stat) => {
16061608
const resolvedType = !err && stat.isDirectory() ? 'dir' : 'file';
Collapse file

‎lib/internal/bootstrap/pre_execution.js‎

Copy file name to clipboardExpand all lines: lib/internal/bootstrap/pre_execution.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ function patchProcessObject(expandArgv1) {
101101
const path = require('path');
102102
try {
103103
process.argv[1] = path.resolve(process.argv[1]);
104-
} catch {}
104+
} catch {
105+
// Continue regardless of error.
106+
}
105107
}
106108

107109
// TODO(joyeecheung): most of these should be deprecated and removed,
Collapse file

‎lib/internal/error_serdes.js‎

Copy file name to clipboardExpand all lines: lib/internal/error_serdes.js
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ function TryGetAllProperties(object, target = object) {
4848
if (getter && key !== '__proto__') {
4949
try {
5050
descriptor.value = FunctionPrototypeCall(getter, target);
51-
} catch {}
51+
} catch {
52+
// Continue regardless of error.
53+
}
5254
}
5355
if ('value' in descriptor && typeof descriptor.value !== 'function') {
5456
delete descriptor.get;
@@ -107,11 +109,15 @@ function serializeError(error) {
107109
}
108110
}
109111
}
110-
} catch {}
112+
} catch {
113+
// Continue regardless of error.
114+
}
111115
try {
112116
const serialized = serialize(error);
113117
return Buffer.concat([Buffer.from([kSerializedObject]), serialized]);
114-
} catch {}
118+
} catch {
119+
// Continue regardless of error.
120+
}
115121
return Buffer.concat([Buffer.from([kInspectedError]),
116122
Buffer.from(inspect(error), 'utf8')]);
117123
}
Collapse file

‎lib/internal/main/worker_thread.js‎

Copy file name to clipboardExpand all lines: lib/internal/main/worker_thread.js
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,18 @@ function workerOnGlobalUncaughtException(error, fromPromise) {
226226
if (!handlerThrew) {
227227
process.emit('exit', process.exitCode);
228228
}
229-
} catch {}
229+
} catch {
230+
// Continue regardless of error.
231+
}
230232
}
231233

232234
let serialized;
233235
try {
234236
const { serializeError } = require('internal/error_serdes');
235237
serialized = serializeError(error);
236-
} catch {}
238+
} catch {
239+
// Continue regardless of error.
240+
}
237241
debug(`[${threadId}] uncaught exception serialized = ${!!serialized}`);
238242
if (serialized)
239243
port.postMessage({
Collapse file

‎lib/internal/modules/cjs/loader.js‎

Copy file name to clipboardExpand all lines: lib/internal/modules/cjs/loader.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,9 @@ Module._extensions['.js'] = function(module, filename) {
11281128
let parentSource;
11291129
try {
11301130
parentSource = fs.readFileSync(parentPath, 'utf8');
1131-
} catch {}
1131+
} catch {
1132+
// Continue regardless of error.
1133+
}
11321134
if (parentSource) {
11331135
const errLine = StringPrototypeSplit(
11341136
StringPrototypeSlice(err.stack, StringPrototypeIndexOf(
Collapse file

‎lib/internal/modules/esm/module_job.js‎

Copy file name to clipboardExpand all lines: lib/internal/modules/esm/module_job.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ class ModuleJob {
154154
// care about CommonJS for the purposes of this error message.
155155
({ format } =
156156
await this.loader.load(childFileURL));
157-
} catch {}
157+
} catch {
158+
// Continue regardless of error.
159+
}
158160

159161
if (format === 'commonjs') {
160162
const importStatement = splitStack[1];
Collapse file

‎lib/internal/modules/esm/resolve.js‎

Copy file name to clipboardExpand all lines: lib/internal/modules/esm/resolve.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,9 @@ function resolvePackageTargetString(
474474
try {
475475
new URL(target);
476476
isURL = true;
477-
} catch {}
477+
} catch {
478+
// Continue regardless of error.
479+
}
478480
if (!isURL) {
479481
const exportTarget = pattern ?
480482
RegExpPrototypeSymbolReplace(patternRegEx, target, () => subpath) :
Collapse file

‎lib/internal/modules/esm/translators.js‎

Copy file name to clipboardExpand all lines: lib/internal/modules/esm/translators.js
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ translators.set('commonjs', async function commonjsStrategy(url, source,
180180
let value;
181181
try {
182182
value = exports[exportName];
183-
} catch {}
183+
} catch {
184+
// Continue regardless of error.
185+
}
184186
this.setExport(exportName, value);
185187
}
186188
this.setExport('default', exports);
@@ -205,7 +207,9 @@ function cjsPreparseModuleExports(filename) {
205207
let source;
206208
try {
207209
source = readFileSync(filename, 'utf8');
208-
} catch {}
210+
} catch {
211+
// Continue regardless of error.
212+
}
209213

210214
let exports, reexports;
211215
try {
Collapse file

‎lib/internal/policy/manifest.js‎

Copy file name to clipboardExpand all lines: lib/internal/policy/manifest.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,9 @@ function canonicalizeSpecifier(specifier, base) {
639639
return resolve(specifier, base).href;
640640
}
641641
return resolve(specifier).href;
642-
} catch {}
642+
} catch {
643+
// Continue regardless of error.
644+
}
643645
return specifier;
644646
}
645647

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.