-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[mustache_template] Improve error throwing #10700
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
[mustache_template] Improve error throwing #10700
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request effectively addresses error handling issues by adding missing throw statements in LambdaContext and replacing Exception with the more appropriate StateError for unreachable code in Parser. The changes are correct and improve the code's robustness. I have a few minor suggestions to ensure consistency in error message formatting.
6f030ac to
0b77d34
Compare
0b77d34 to
cd71312
Compare
stuartmorgan-g
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just changelog nits; thanks for this cleanup!
This could be considered a breaking change, since calls that didn't throw before now do, so we could be conservative and make this a major version change, but since it only affects incorrect usage, and thus hopefully won't affect any actual clients, I think we can treat is as a bugfix. (If that turns out to be incorrect, and a non-trivial number of people are broken by it, we can retract it.)
flutter/packages@d3f860d...9705815 2026-01-07 47866232+chunhtai@users.noreply.github.com [ci] setup flutter in batch release workflow (flutter/packages#10735) 2026-01-07 augustocesarperin@gmail.com [mustache_template] Improve error throwing (flutter/packages#10700) 2026-01-06 47866232+chunhtai@users.noreply.github.com [ci] Adjust workflow for dispatching go_router batch release (flutter/packages#10733) 2026-01-06 116356835+AbdeMohlbi@users.noreply.github.com [rfw] Remove scripting language integration section from `README` (flutter/packages#10726) 2026-01-06 stuartmorgan@google.com [image_picker] Update for UIScene compatibility (flutter/packages#10677) 2026-01-06 stuartmorgan@google.com [google_maps_flutter] Add iOS SDK 10.x support (flutter/packages#10720) 2026-01-06 6655696+guidezpl@users.noreply.github.com Update Google Fonts to v7.0.0 with new and removed fonts (flutter/packages#10713) 2026-01-06 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump the kotlin-gradle-plugin group across 7 directories with 1 update (flutter/packages#10661) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
flutter/packages@d3f860d...9705815 2026-01-07 47866232+chunhtai@users.noreply.github.com [ci] setup flutter in batch release workflow (flutter/packages#10735) 2026-01-07 augustocesarperin@gmail.com [mustache_template] Improve error throwing (flutter/packages#10700) 2026-01-06 47866232+chunhtai@users.noreply.github.com [ci] Adjust workflow for dispatching go_router batch release (flutter/packages#10733) 2026-01-06 116356835+AbdeMohlbi@users.noreply.github.com [rfw] Remove scripting language integration section from `README` (flutter/packages#10726) 2026-01-06 stuartmorgan@google.com [image_picker] Update for UIScene compatibility (flutter/packages#10677) 2026-01-06 stuartmorgan@google.com [google_maps_flutter] Add iOS SDK 10.x support (flutter/packages#10720) 2026-01-06 6655696+guidezpl@users.noreply.github.com Update Google Fonts to v7.0.0 with new and removed fonts (flutter/packages#10713) 2026-01-06 49699333+dependabot[bot]@users.noreply.github.com [dependabot]: Bump the kotlin-gradle-plugin group across 7 directories with 1 update (flutter/packages#10661) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Addresses error handling issues flagged in the Gemini review of mustache_template.
Changes:
throwbefore _error() calls in lambda_context.dartExceptiontoStateErrorfor unreachable code in parser.dartFixes flutter/flutter#174938
Pre-Review Checklist
[shared_preferences]///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3