capture image generation errors in Sentry
This commit is contained in:
parent
2d877c0d84
commit
3d056fcb10
@ -3,6 +3,7 @@ import re
|
|||||||
from typing import Dict, List, Literal, Union
|
from typing import Dict, List, Literal, Union
|
||||||
from openai import AsyncOpenAI
|
from openai import AsyncOpenAI
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
|
import sentry_sdk
|
||||||
|
|
||||||
from image_generation.replicate import call_replicate
|
from image_generation.replicate import call_replicate
|
||||||
|
|
||||||
@ -29,6 +30,10 @@ async def process_tasks(
|
|||||||
for result in results:
|
for result in results:
|
||||||
if isinstance(result, Exception):
|
if isinstance(result, Exception):
|
||||||
print(f"An exception occurred: {result}")
|
print(f"An exception occurred: {result}")
|
||||||
|
try:
|
||||||
|
raise result
|
||||||
|
except Exception:
|
||||||
|
sentry_sdk.capture_exception()
|
||||||
processed_results.append(None)
|
processed_results.append(None)
|
||||||
else:
|
else:
|
||||||
processed_results.append(result)
|
processed_results.append(result)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user