Skip to content

Conversation

@marklundin
Copy link
Collaborator

This PR enhances error reporting and context handling throughout the attribute and script parsing logic. The main focus is on propagating scriptName and attributeName information into parsing errors, making debugging and error tracing much easier. Additionally, some minor bug fixes and improvements are included in how attribute positions are calculated.

  • Refactored ParsingError to include additional context in error messages, improving clarity on the source of errors.
  • Modified JSDocParser to pass scriptName during attribute extraction, ensuring consistent error reporting across scripts.
  • Enhanced tests to verify the presence of scriptName in error outputs, ensuring comprehensive error tracking.

- Updated `AttributeParser` and `ScriptParser` to include `scriptName` and `attributeName` in error handling, providing better context for parsing errors.
- Refactored `ParsingError` to include additional context in error messages, improving clarity on the source of errors.
- Modified `JSDocParser` to pass `scriptName` during attribute extraction, ensuring consistent error reporting across scripts.
- Enhanced tests to verify the presence of `scriptName` in error outputs, ensuring comprehensive error tracking.
@marklundin marklundin self-assigned this Aug 8, 2025
@marklundin marklundin added the enhancement New feature or request label Aug 8, 2025
@marklundin marklundin requested review from Copilot and kpal81xd August 8, 2025 12:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances error reporting by propagating script and attribute names into parsing errors throughout the codebase. The main goal is to provide better debugging context by including scriptName and attributeName information in error messages and error objects.

  • Enhanced ParsingError constructor to accept and store scriptName and attributeName context
  • Modified parsing methods to pass script and attribute names through the call chain
  • Updated error generation to include contextual information for better debugging

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/parsers/parsing-error.js Enhanced constructor to accept script/attribute names and improved toString() formatting
src/parsers/script-parser.js Modified to pass scriptName through parsing calls and updated error creation
src/parsers/attribute-parser.js Updated methods to accept and use scriptName/attributeName parameters
src/index.js Modified to pass scriptName during attribute extraction and fixed attribute position calculation
test/tests/valid/export.test.js Added test assertions to verify scriptName presence in error objects

marklundin and others added 4 commits August 8, 2025 15:34
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Collaborator

@kpal81xd kpal81xd left a comment

Choose a reason for hiding this comment

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

Nice

@marklundin marklundin merged commit 9653c89 into main Aug 8, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants