when all generations fail, print the all the underlying exceptions for debugging
This commit is contained in:
parent
9199fee21d
commit
6899c7792e
@ -1,5 +1,6 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
import traceback
|
||||||
from fastapi import APIRouter, WebSocket
|
from fastapi import APIRouter, WebSocket
|
||||||
import openai
|
import openai
|
||||||
from codegen.utils import extract_html_content
|
from codegen.utils import extract_html_content
|
||||||
@ -321,6 +322,12 @@ async def stream_code(websocket: WebSocket):
|
|||||||
)
|
)
|
||||||
if all_generations_failed:
|
if all_generations_failed:
|
||||||
await throw_error("Error generating code. Please contact support.")
|
await throw_error("Error generating code. Please contact support.")
|
||||||
|
|
||||||
|
# Print the all the underlying exceptions for debugging
|
||||||
|
for completion in completions:
|
||||||
|
traceback.print_exception(
|
||||||
|
type(completion), completion, completion.__traceback__
|
||||||
|
)
|
||||||
raise Exception("All generations failed")
|
raise Exception("All generations failed")
|
||||||
|
|
||||||
# If some completions failed, replace them with empty strings
|
# If some completions failed, replace them with empty strings
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user