Skip to content

fix: improve error messages when files are missing or mismatched #122

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

Merged
merged 1 commit into from
Apr 24, 2025

Conversation

comp615
Copy link
Contributor

@comp615 comp615 commented Apr 24, 2025

Fixes #121

Problem
Errors are most helpful when they give the user information about how to self-resolve them, without needing to search too deep. When the dist files cannot be matched to src files, the error right now alerts the user to that, but doesn't tell them what it expects. This requires them to go look elsewhere to realize the extension mappings or that the bare names must match.

Solution
We can be a little more verbose with our error messages:

  • Break apart invalid dist extensions and missing source extensions into separate cases for clarity
  • Include expected file name options in the error messages for each

This should create errors which give the users immediate solutions if they are using pkgroll for the first time.

NOTE: I also rewrote a for + if statement into a some statement because I find that easier to reason about. Feel free to undo that if you have strong opinions.

NOTE: I also had to jump through hoops to get the linter happy because it wouldn't let me multi-line an arrow, but also complained it was over 100 chars, but also wouldn't let me use ext as a name. So I ended up grabbing the actual prop we care about.

@privatenumber privatenumber merged commit 5a73adf into privatenumber:master Apr 24, 2025
2 checks passed
@privatenumber
Copy link
Owner

Thanks Charlie 👍

@privatenumber
Copy link
Owner

🎉 This PR is included in version 2.12.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better error messaging on failed build
2 participants