Skip to content

Include the offending path in the property-name parse exception#1474

Merged
seanmcleod70 merged 3 commits into
JSBSim-Team:masterfrom
Zaretto:fix/props-parse-exception
Jun 24, 2026
Merged

Include the offending path in the property-name parse exception#1474
seanmcleod70 merged 3 commits into
JSBSim-Team:masterfrom
Zaretto:fix/props-parse-exception

Conversation

@Zaretto

@Zaretto Zaretto commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

The property-name parser throws when a name contains a disallowed character but does not indicate which property path triggered it. Append the path to the exception message so the offending property can be identified.

The property-name parser throws when a name contains a disallowed character but does not indicate which property path triggered it. Append the path to the exception message so the offending property can be identified.
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 25.10%. Comparing base (0b99c70) to head (e9ddf8f).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1474   +/-   ##
=======================================
  Coverage   25.10%   25.10%           
=======================================
  Files         171      171           
  Lines       18843    18843           
=======================================
  Hits         4731     4731           
  Misses      14112    14112           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@seanmcleod70

Copy link
Copy Markdown
Contributor

So it looks like elsewhere in the same function some identifying information is included as part of the exception of the message. Any reason for not being consistent in terms of how the string is built for the exception message?

throw string("Illegal character after " + name);

What about this case lower down in the same function, should we not also include the path name in the exception to help users figure out which path name is problematic?

throw string("name must begin with alpha or '_'");

@bcoconni

Copy link
Copy Markdown
Member

I agree with @seanmcleod70 that all the throw instances in that function shall be treated equally.

@Zaretto

Zaretto commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

I also agree with you both so I'll make the fixes.

Zaretto added a commit to Zaretto/jsbsim that referenced this pull request Jun 22, 2026
…exceptions

All throw sites in the active parser now append the offending path so a malformed property path can be identified from the exception message. This covers the three exceptions in parse_name and the neighbouring unterminated-index exception in parse_index. Each message is built the same way, inside the string constructor, and the path is quoted so it stays legible when it contains a space or a colon. The change is confined to the parser compiled in this configuration (PROPS_STANDALONE); the template parser in the #else branch is left unchanged.
@Zaretto Zaretto force-pushed the fix/props-parse-exception branch from dc99ac9 to 0ba9674 Compare June 22, 2026 20:55
@Zaretto

Zaretto commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

I have made all the exceptions in the active parser consistent:

  • Each message is now built the same way, inside the string constructor.
  • Each appends the offending path, quoted so it stays readable if the path contains a space or a colon.
  • This covers the three throws in parse_name and the neighbouring "unterminated index" throw in parse_index, so a
    bad path is reported wherever parsing fails.

The change is confined to the parser compiled here (PROPS_STANDALONE).

Zaretto added 2 commits June 23, 2026 13:33
…exceptions

All throw sites in the active parser now append the offending path so a malformed property path can be identified from the exception message. This covers the three exceptions in parse_name and the neighbouring unterminated-index exception in parse_index. Each message is built the same way, inside the string constructor, and the path is quoted so it stays legible when it contains a space or a colon. The change is confined to the parser compiled in this configuration (PROPS_STANDALONE); the template parser in the #else branch is left unchanged.
@Zaretto Zaretto force-pushed the fix/props-parse-exception branch from 0ba9674 to e9ddf8f Compare June 23, 2026 12:33
@seanmcleod70 seanmcleod70 merged commit 7881660 into JSBSim-Team:master Jun 24, 2026
32 checks passed
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.

3 participants