Skip to content

Commit

Permalink
Include error handling while fetching data
Browse files Browse the repository at this point in the history
  • Loading branch information
anasserhussien committed Apr 28, 2024
1 parent cc18e3d commit 36aff1e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,13 @@ async def read_wiki_url(request: Request, wiki: Wiki):

url = wiki.wiki_url
error_message = ""
docs = load_wiki_article(url)
splits = wiki_text_splitter(docs)
await create_db(splits)
try:
docs = load_wiki_article(url)
splits = wiki_text_splitter(docs)
await create_db(splits)
except Exception as e:
print(str(e))
raise Exception(str(e))
#print('Finished execution')


Expand Down

0 comments on commit 36aff1e

Please sign in to comment.