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

[rush] Given out the filename of the local projects package.json file where the error occured during rush command #4676

Merged
merged 3 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@microsoft/rush",
"comment": "Provide the file path if there is an error parsing a `package.json` file.",
"type": "none"
}
],
"packageName": "@microsoft/rush"
}
5 changes: 5 additions & 0 deletions libraries/rush-lib/src/api/RushConfigurationProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ export class RushConfigurationProject {
if (FileSystem.isNotExistError(error as Error)) {
throw new Error(`Could not find package.json for ${packageName} at ${packageJsonFilename}`);
}

// Encountered an error while loading the package.json file. Please append the error message with the corresponding file location.
if (error instanceof SyntaxError) {
error.message = `${error.message}\nFilename: ${packageJsonFilename}`;
}
throw error;
}

Expand Down