Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 Feature: Error naming unification #5258

Open
3 tasks done
wnghdcjfe opened this issue Nov 17, 2024 · 1 comment · May be fixed by #5260
Open
3 tasks done

🚀 Feature: Error naming unification #5258

wnghdcjfe opened this issue Nov 17, 2024 · 1 comment · May be fixed by #5260
Labels
area: repository tooling concerning ease of contribution status: in triage a maintainer should (re-)triage (review) this issue

Comments

@wnghdcjfe
Copy link
Contributor

Feature Request Checklist

Overview

Sometimes the error is written as e, sometimes as err. Why don't we unify it as err?

      try {
        foundReporter = require.resolve(reporterName);
        reporter = require(foundReporter);
      } catch (err) {
        if (foundReporter) {
          throw createInvalidReporterError(err.message, foundReporter);
        }
        // Try to load reporters from a cwd-relative path
        try {
          reporter = require(path.resolve(reporterName));
        } catch (e) {
          throw createInvalidReporterError(e.message, reporterName);
        }
      }

Suggested Solution

      try {
        foundReporter = require.resolve(reporterName);
        reporter = require(foundReporter);
      } catch (err) {
        if (foundReporter) {
          throw createInvalidReporterError(err.message, foundReporter);
        }
        // Try to load reporters from a cwd-relative path
        try {
          reporter = require(path.resolve(reporterName));
        } catch (err) {
          throw createInvalidReporterError(err.message, reporterName);
        }
      }

Alternatives

.

Additional Info

.

@wnghdcjfe wnghdcjfe added status: in triage a maintainer should (re-)triage (review) this issue type: feature enhancement proposal labels Nov 17, 2024
wnghdcjfe added a commit to wnghdcjfe/mocha that referenced this issue Nov 17, 2024
@JoshuaKGoldberg JoshuaKGoldberg added area: repository tooling concerning ease of contribution and removed type: feature enhancement proposal labels Nov 17, 2024
@JoshuaKGoldberg
Copy link
Member

Hmm, this is a repository tooling request, not so much a feature request.

👍 from me on picking a name and sticking with it. As to which name... I personally prefer full names like error over abbreviations like err or e. But that's just me. @mochajs/maintenance-crew might have an opinion here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: repository tooling concerning ease of contribution status: in triage a maintainer should (re-)triage (review) this issue
Projects
None yet
2 participants