correctly format traceback when logging errors

This commit is contained in:
Nate Sesti 2023-07-11 15:02:45 -07:00
parent 3fc16804fe
commit 7780bbed2a
4 changed files with 4 additions and 4 deletions

View file

@ -285,7 +285,7 @@ class Autopilot(ContinueBaseModel):
e.__class__, ContinueCustomException)
error_string = e.message if is_continue_custom_exception else '\n'.join(
traceback.format_tb(e.__traceback__)) + f"\n\n{e.__repr__()}"
traceback.format_exception(e))
error_title = e.title if is_continue_custom_exception else get_error_title(
e)

View file

@ -16,7 +16,7 @@ def create_async_task(coro: Coroutine, unique_id: Union[str, None] = None):
except Exception as e:
print("Exception caught from async task: ", e)
capture_event(unique_id or "None", "async_task_error", {
"error_title": e.__str__() or e.__repr__(), "error_message": traceback.format_tb(e.__traceback__)
"error_title": e.__str__() or e.__repr__(), "error_message": traceback.format_exception(e)
})
task.add_done_callback(callback)

View file

@ -189,7 +189,7 @@ async def websocket_endpoint(websocket: WebSocket, session: Session = Depends(we
except Exception as e:
print("ERROR in gui websocket: ", e)
capture_event(session.autopilot.continue_sdk.ide.unique_id, "gui_error", {
"error_title": e.__str__() or e.__repr__(), "error_message": traceback.format_tb(e.__traceback__)})
"error_title": e.__str__() or e.__repr__(), "error_message": traceback.format_exception(e)})
raise e
finally:
print("Closing gui websocket")

View file

@ -414,6 +414,6 @@ async def websocket_endpoint(websocket: WebSocket):
except Exception as e:
print("Error in ide websocket: ", e)
capture_event(ideProtocolServer.unique_id, "gui_error", {
"error_title": e.__str__() or e.__repr__(), "error_message": traceback.format_tb(e.__traceback__)})
"error_title": e.__str__() or e.__repr__(), "error_message": traceback.format_exception(e)})
await websocket.close()
raise e