Skip to content

Commit

Permalink
Add detailed error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
KastanDay committed Nov 20, 2023
1 parent 788c063 commit 1ffa5bd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions ai_ta_backend/nomic_logging.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import datetime
import inspect
import os
import time
import traceback
import requests
import nomic
import numpy as np
Expand Down Expand Up @@ -141,8 +143,9 @@ def log_convo_to_nomic(course_name: str, conversation) -> str:
return f"Successfully logged for {course_name}"
else:
# for rest of the errors - return fail
print("ERROR in log_convo_to_nomic():", e)
return f"Logging failed for {course_name}"
err = f"❌❌ Error in log_convo_to_nomic() for course `{course_name}`: {e}\nTraceback: {traceback.extract_tb(e.__traceback__)}" # type: ignore
print(err)
return err


def get_nomic_map(course_name: str):
Expand Down Expand Up @@ -439,7 +442,9 @@ def create_map_for_all_courses():
print("Project Maps: ", project.maps)
project.create_index(index_name, build_topic_model=True)
except Exception as e:
print("Failed to create map due to error: ", e)
err = f"❌❌ Failed to create map create_map_for_all_courses(): {e}\nTraceback: {traceback.extract_tb(e.__traceback__)}" # type: ignore
print(err)
return err

if __name__ == '__main__':
pass

0 comments on commit 1ffa5bd

Please sign in to comment.