[tool] Assert when trying to get filename of a non-file artifact#120484
[tool] Assert when trying to get filename of a non-file artifact#120484mdebbar wants to merge 3 commits intoflutter:masterfrom
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). 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. |
| case Artifact.windowsDesktopPath: | ||
| case Artifact.flutterToolsFileGenerators: | ||
| return ''; | ||
| assert(false, 'No filename for a folder path, should not be invoked'); |
There was a problem hiding this comment.
can we throw UnimplementedError()? asserts only run in unit tests, so if we have untested code paths I think it would be better to know about it.
christopherfujino
left a comment
There was a problem hiding this comment.
change LGTM, I suppose it remains to be seen if we can get all the tests passing or if there was some workflow that depended on the empty strings
|
@christopherfujino looks like some workflows go through this code path and don't expect an error to be thrown. Search for |
Instead of returning an empty string, let's assert whenever the code is trying to get a filename for a non-file artifact. When this happens, it's most likely a bug in our logic that needs to be fixed, so an assertion seems more appropriate.
Depends on #120363