Skip to content

Improve error messages by including the path#356

Closed
simhnna wants to merge 1 commit intopillarjs:masterfrom
simhnna:include-path-in-error-messages
Closed

Improve error messages by including the path#356
simhnna wants to merge 1 commit intopillarjs:masterfrom
simhnna:include-path-in-error-messages

Conversation

@simhnna
Copy link
Copy Markdown
Contributor

@simhnna simhnna commented Apr 7, 2025

Without the path users need to search all their code for a malformed path or debug to find the issue

Closes: #336

Without the path users need to search all their code for a malformed
path or debug to find the issue

Closes: pillarjs#336
@simhnna
Copy link
Copy Markdown
Contributor Author

simhnna commented Apr 7, 2025

Tried a couple of different places to include the path in the error message and I think prepending it is the easiest to read but if you'd like it somewhere else I'd update accordingly

Copy link
Copy Markdown
Member

@blakeembrey blakeembrey left a comment

Choose a reason for hiding this comment

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

I appreciate this PR, it's a great direction! However I think it'd be good to avoid using stringify as it can output a different path to the original input, and instead add a originalPath or something to TokenData. I can open a PR you can review if that's OK?

@blakeembrey
Copy link
Copy Markdown
Member

I've just merged #363 which adds the original path to the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve error message when parsing fails

2 participants