Spaces:
Runtime error
Runtime error
Commit
·
a37fbff
1
Parent(s):
5930ae6
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
from github import Github
|
3 |
-
from github import
|
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
|
38 |
# Catch the exception if the file is not found in the repository
|
39 |
-
|
|
|
|
|
|
|
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
|