fix(article): handle gist fetch errors gracefully
Added try-except block around gist fetch to handle potential errors more gracefully by printing error messages instead of failing silently. This improves debugging and user experience when fetching GitHub gists in articles.
This commit is contained in:
parent
d09267cd6c
commit
7d208780aa
1 changed files with 6 additions and 4 deletions
|
@ -23,9 +23,11 @@ def article(article_url):
|
|||
for paragraph in page.content:
|
||||
for child in paragraph.children:
|
||||
if child.__class__.__name__ == "GithubGist":
|
||||
gist_id = child.id
|
||||
gist = GithubClient.get_gist(gist_id)
|
||||
child.content = gist
|
||||
try:
|
||||
gist = GithubClient.get_gist(child.id)
|
||||
child.content = gist
|
||||
except Exception as e:
|
||||
print(f"Error fetching gist: {str(e)}")
|
||||
|
||||
return render_template("article.html", page=page)
|
||||
except Exception as e:
|
||||
|
|
Loading…
Reference in a new issue