Skip to content

Commit d4912e7

Browse files
authored
chore: unify caught errors as err (#5439)
1 parent 02a306c commit d4912e7

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

browser-entry.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ process.on = function (e, fn) {
7979
}
8080
};
8181

82-
process.listeners = function (e) {
83-
if (e === 'uncaughtException') {
82+
process.listeners = function (err) {
83+
if (err === 'uncaughtException') {
8484
return uncaughtExceptionHandlers;
8585
}
8686
return [];

lib/cli/run-helpers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ exports.validateLegacyPlugin = (opts, pluginType, map = {}) => {
285285
// Try to load reporters from a cwd-relative path
286286
try {
287287
map[pluginId] = require(path.resolve(pluginId));
288-
} catch (e) {
289-
throw createUnknownError(e);
288+
} catch (err) {
289+
throw createUnknownError(err);
290290
}
291291
}
292292
}

lib/cli/watch-run.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,8 @@ const createRerunner = (mocha, watcher, {beforeRun} = {}) => {
314314
console.error(`${logSymbols.info} [mocha] waiting for changes...`);
315315
}
316316
});
317-
} catch (e) {
318-
console.error(e.stack);
317+
} catch (err) {
318+
console.error(err.stack);
319319
}
320320
};
321321

lib/mocha.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,8 @@ Mocha.prototype.reporter = function (reporterName, reporterOptions) {
346346
// Try to load reporters from a cwd-relative path
347347
try {
348348
reporter = require(path.resolve(reporterName));
349-
} catch (e) {
350-
throw createInvalidReporterError(e.message, reporterName);
349+
} catch (err) {
350+
throw createInvalidReporterError(err.message, reporterName);
351351
}
352352
}
353353
}

test/integration/helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ function touchFile(filepath) {
504504
fs.mkdirSync(path.dirname(filepath), { recursive: true });
505505
try {
506506
fs.utimesSync(filepath, touchRef, touchRef);
507-
} catch (e) {
507+
} catch (err) {
508508
const fd = fs.openSync(filepath, 'a');
509509
fs.closeSync(fd);
510510
}

0 commit comments

Comments
 (0)