Skip to content

refactor: change error msg#89

Merged
Ki-Seki merged 1 commit intomainfrom
Ki-Seki-patch-1
Oct 7, 2025
Merged

refactor: change error msg#89
Ki-Seki merged 1 commit intomainfrom
Ki-Seki-patch-1

Conversation

@Ki-Seki
Copy link
Copy Markdown
Member

@Ki-Seki Ki-Seki commented Oct 7, 2025

No description provided.

@Ki-Seki Ki-Seki requested a review from Copilot October 7, 2025 08:56
Copy link
Copy Markdown
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

Refactor updates the InvalidFormatError message in parse_parts to include the full input string rather than a truncated preview. This changes what gets surfaced/logged when mismatched or nested masked tags are detected.

  • Expand error detail to include full string s
  • Remove prior truncation and ellipsis from the error message

Comment thread src/gimkit/schemas.py
full_matches = list(TAG_FULL_PATTERN.finditer(s))
if not (len(open_matches) == len(end_matches) == len(full_matches)):
raise InvalidFormatError(f"Mismatched or nested masked tags in {s[:50]}...")
raise InvalidFormatError(f"Mismatched or nested masked tags in {s}")
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

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

Including the full input string in the error can leak sensitive or user-provided content if exceptions are logged or surfaced. Prefer emitting a bounded preview and indicate truncation, e.g., limit to 50–100 chars and add '...' when longer.

Suggested change
raise InvalidFormatError(f"Mismatched or nested masked tags in {s}")
preview = s[:100] + ("..." if len(s) > 100 else "")
raise InvalidFormatError(f"Mismatched or nested masked tags in input (preview: '{preview}')")

Copilot uses AI. Check for mistakes.
Comment thread src/gimkit/schemas.py
full_matches = list(TAG_FULL_PATTERN.finditer(s))
if not (len(open_matches) == len(end_matches) == len(full_matches)):
raise InvalidFormatError(f"Mismatched or nested masked tags in {s[:50]}...")
raise InvalidFormatError(f"Mismatched or nested masked tags in {s}")
Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

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

Formatting the entire input string into the exception can significantly bloat log lines and allocations for very large inputs. Use a concise preview (e.g., s[:50] with an ellipsis when longer) to keep error messages lightweight.

Suggested change
raise InvalidFormatError(f"Mismatched or nested masked tags in {s}")
preview = s[:50] + ("..." if len(s) > 50 else "")
raise InvalidFormatError(f"Mismatched or nested masked tags in input: '{preview}'")

Copilot uses AI. Check for mistakes.
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Ki-Seki Ki-Seki merged commit b6a473a into main Oct 7, 2025
6 checks passed
@Ki-Seki Ki-Seki deleted the Ki-Seki-patch-1 branch October 7, 2025 09:03
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.

2 participants