Not-Grim-Refer commited on
Commit
a37fbff
·
1 Parent(s): 5930ae6
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import streamlit as st
2
  from github import Github
3
- from github import UnknownObjectException
4
 
5
  # Set up the Streamlit app
6
  st.set_page_config(page_title="GitHub File Search", page_icon=":mag_right:")
@@ -34,9 +34,12 @@ def get_repositories_with_file(filename):
34
  })
35
  break
36
 
37
- except UnknownObjectException as e:
38
  # Catch the exception if the file is not found in the repository
39
- st.warning(f"File '{filename}' not found in repository '{repo.full_name}'.")
 
 
 
40
 
41
  # Return the repository information
42
  return repo_info
 
1
  import streamlit as st
2
  from github import Github
3
+ from github import GithubException
4
 
5
  # Set up the Streamlit app
6
  st.set_page_config(page_title="GitHub File Search", page_icon=":mag_right:")
 
34
  })
35
  break
36
 
37
+ except GithubException as e:
38
  # Catch the exception if the file is not found in the repository
39
+ if e.status == 404:
40
+ st.warning(f"File '{filename}' not found in repository '{repo.full_name}'.")
41
+ else:
42
+ st.error(f"Error occurred while searching for file '{filename}' in repository '{repo.full_name}': {str(e)}")
43
 
44
  # Return the repository information
45
  return repo_info