-
Notifications
You must be signed in to change notification settings - Fork 14
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
fix: Handle parsing errors #40
Conversation
lib/parse_stringify_toggles.dart
Outdated
var decoded = jsonDecode(body); | ||
|
||
// Return an empty map if 'toggles' isn't a list or doesn't exist | ||
if (decoded['toggles'] is! List) { |
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.
I'd really rather avoid checking for a list here. Stuff should fail and the new catch block should catch that, right? I don't really see a reason this function needs to change, it looks like it's correct, it's getting fed garbage data
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.
sure makes sense - this was my initial fix, but the try/catch should be enough here agreed
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.
Nice! I think this looks good, but maybe we keep this open until we understand more about this problem. I'd need to go root around a little in the code
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.
Yeah let's do the thing
Catch any errors from parsing toggles from storage
Relates to #39