Skip to content

Commit

Permalink
Merge pull request Significant-Gravitas#759 from BillSchumacher/fix-t…
Browse files Browse the repository at this point in the history
…oo-specific-except

Fix case where index throws value error.
  • Loading branch information
Torantulino authored Apr 12, 2023
2 parents 1e98d34 + 66d316a commit e4bb730
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/json_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def fix_and_parse_json(
last_brace_index = json_str.rindex("}")
json_str = json_str[:last_brace_index+1]
return json.loads(json_str)
except json.JSONDecodeError as e: # noqa: F841
except (json.JSONDecodeError, ValueError) as e: # noqa: F841
if try_to_fix_with_gpt:
print("Warning: Failed to parse AI output, attempting to fix."
"\n If you see this warning frequently, it's likely that"
Expand Down

0 comments on commit e4bb730

Please sign in to comment.