fix: move except ValueError up right after find_original_update_blocks

This commit is contained in:
Paul Gauthier (aider) 2024-08-22 08:19:44 -07:00
parent 1e1bb53ca3
commit 9982863042

View file

@ -31,6 +31,10 @@ def process_markdown(filename):
# Process the content with find_original_update_blocks
try:
blocks = list(find_original_update_blocks(content, DEFAULT_FENCE))
except ValueError as e:
# If an error occurs, add it to the results for this section
results.append({"header": header, "error": str(e)})
continue
# Create a dictionary for this section
section_result = {"header": header, "blocks": []}
@ -49,9 +53,6 @@ def process_markdown(filename):
)
results.append(section_result)
except ValueError as e:
# If an error occurs, add it to the results for this section
results.append({"header": header, "error": str(e)})
# Output the results as JSON
print(json.dumps(results, indent=4))