davanstrien HF Staff commited on
Commit
f5ede9e
·
1 Parent(s): 767009a

Add error handling for no authors found

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -86,6 +86,8 @@ def get_papers(
86
  hf_user_name = hf_user_name.preferred_username
87
  positive_arxiv_ids = positive_arxiv_ids.split(",")
88
  potential_authors = query_author(author_name)
 
 
89
  author = get_author_from_options(potential_authors, positive_arxiv_ids)
90
  papers = get_arxiv_paper(author["papers"])
91
  papers = sort_by_date(papers)
 
86
  hf_user_name = hf_user_name.preferred_username
87
  positive_arxiv_ids = positive_arxiv_ids.split(",")
88
  potential_authors = query_author(author_name)
89
+ if not potential_authors:
90
+ raise gr.Error("No authors found with that name")
91
  author = get_author_from_options(potential_authors, positive_arxiv_ids)
92
  papers = get_arxiv_paper(author["papers"])
93
  papers = sort_by_date(papers)