Skip to content

Commit 2d8c134

Browse files
Enhance error handling in orchestrator.py with debug logging for JSON parsing failures
1 parent 2cf9646 commit 2d8c134

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

content-gen/docs/QuotaCheck.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ australiaeast, centralus, eastasia, eastus, eastus2, japaneast, northeurope, sou
6060
### **Sample Output**
6161
The final table lists regions with available quota. You can select any of these regions for deployment.
6262

63-
![quota-check-ouput](images/quota-check-output.png)
63+
![quota-check-output](images/quota-check-output.png)
6464

6565
---
6666
### **If using Azure Portal and Cloud Shell**

content-gen/src/backend/orchestrator.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,7 +1512,11 @@ async def generate_content(
15121512
prompt_data = json.loads(json_match.group(1))
15131513
prompt_text = prompt_data.get('prompt', prompt_data.get('image_prompt', prompt_text))
15141514
except Exception:
1515-
pass
1515+
logger.debug(
1516+
"Failed to parse JSON image prompt from markdown code block; "
1517+
"continuing with original prompt_text.",
1518+
exc_info=True
1519+
)
15161520

15171521
# Build product description for DALL-E context
15181522
# Include detailed image descriptions if available for better color accuracy
@@ -1745,7 +1749,13 @@ async def regenerate_image(
17451749
prompt_text = prompt_data.get('prompt', prompt_text)
17461750
change_summary = prompt_data.get('change_summary', modification_request)
17471751
except Exception:
1748-
pass
1752+
# If JSON extraction fails here, fall back to the original
1753+
# prompt_text and change_summary values set earlier.
1754+
logger.debug(
1755+
"Failed to parse JSON from markdown in regenerate_image; "
1756+
"using original prompt_text and modification_request.",
1757+
exc_info=True
1758+
)
17491759

17501760
results["image_prompt"] = prompt_text
17511761
results["message"] = f"Regenerating image: {change_summary}"

0 commit comments

Comments
 (0)