Repository navigation
fix: networkRequest no longer throws when no result matches the status code - #505
Conversation
…s code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Description
StacNetworkRequestParser.onCallpicked the result to run withmodel.results.firstWhere(...)and noorElse. AnetworkRequestwhose response status code had no matching entry inresultstherefore threwBad state: No element, including in the default case whereresultsis empty. BecauseonCallis async, the error escaped thetry/catchinStacService.onCallFromJson, so an action fired from a button ended up as an unhandled exception.The parser now looks up the result with
where(...).firstOrNulland returns early when nothing matches: the request still runs and nothing else happens. Whenresultsis non-empty but none match, it logs a warning so a mismatched status code (for example 201 vs 200) is easy to spot. A matching result runs its action as before.Verified locally:
dart analyzereports no issues inpackages/stac, and the repro from the issue no longer throws.Related Issues
Closes #495
Type of Change
🤖 Generated with Claude Code
Summary by CodeRabbit