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

fix: better error message for broken tsconfig.json #501

Merged
merged 3 commits into from Jun 9, 2020

Conversation

alexander-fenster
Copy link
Collaborator

If tsconfig.json cannot be parsed (invalid JSON) we should not say that it's not found.

src/util.ts Outdated
@@ -91,7 +91,7 @@ async function getBase(

return contents;
} catch (err) {
throw new Error(`${filePath} Not Found`);
throw new Error(`Error: ${filePath}: ${err}`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So good catch - how about instead, we prepend the ${filePath} not found to the original err.message, and then re-throw err so we maintain the full stack trace?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you instead capture the stack trace, so that the original stack is in the error, but throw the new message? it feels a little weird mucking with an error (a little too magic).

alexander-fenster and others added 3 commits June 8, 2020 18:55
If `tsconfig.json` cannot be parsed, don't say it's not found.
@JustinBeckwith JustinBeckwith merged commit 0c17a76 into master Jun 9, 2020
@JustinBeckwith JustinBeckwith deleted the misleading branch January 22, 2021 22:39
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.

None yet

4 participants