[bugfix] wrap read metadata.json in a try except block#466
[bugfix] wrap read metadata.json in a try except block#466NihalHarish wants to merge 1 commit intomasterfrom
Conversation
| try: | ||
| parameters = json.load(json_data) | ||
| except json.decoder.JSONDecodeError: | ||
| logger.warning(f"{self._states_file} was empty") |
There was a problem hiding this comment.
This should not have potential to create a log flood since the str is constant.
Keeping the level=warning since we'd ideally want feedback if this behavior is seen by the customers too often
There was a problem hiding this comment.
Open to opinions.
There was a problem hiding this comment.
In what case would the states file be empty? If it's because of a user misconfiguration of some sort, then yes I agree with making this a warning message. Otherwise, I'm not sure. What are the repercussions for the user if the states file is empty?
Codecov Report
@@ Coverage Diff @@
## master #466 +/- ##
==========================================
- Coverage 65.62% 65.21% -0.42%
==========================================
Files 172 162 -10
Lines 13260 12918 -342
==========================================
- Hits 8702 8424 -278
+ Misses 4558 4494 -64
Continue to review full report at Codecov.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #466 +/- ##
==========================================
- Coverage 65.62% 65.21% -0.42%
==========================================
Files 172 162 -10
Lines 13260 12918 -342
==========================================
- Hits 8702 8424 -278
+ Misses 4558 4494 -64 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description of changes:
metadata.jsonfile is empty there is potential that the hook will crash.Style and formatting:
I have run
pre-commit installto ensure that auto-formatting happens with every commit.Issue number, if available
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.