Skip to content

Commit ba11195

Browse files
committed
fix to set failed translation
1 parent f51888b commit ba11195

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pythonkr_backend/curation/utils_trans.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,14 @@ def translate_rssitem(rss_item_id: int):
5454
)
5555

5656
# Run translation
57-
result = agent.run_sync(content)
57+
try:
58+
result = agent.run_sync(content)
59+
except Exception as e:
60+
# Set RSS item status to failed and save error message
61+
rss_item.crawling_status = 'failed'
62+
rss_item.translate_error_message = str(e)
63+
rss_item.save(update_fields=['crawling_status', 'translate_error_message'])
64+
raise
5865

5966
# Create TranslatedContent instance
6067
translated_content = TranslatedContent(

0 commit comments

Comments
 (0)