Skip to content

Commit

Permalink
fix: log error if file is not reachable
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiogra committed Jul 12, 2023
1 parent 99a6014 commit 878b9a1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
from base64 import b64encode
from io import BytesIO
from pathlib import Path
from loguru import logger as log

import matplotlib.pyplot as plt
import numpy as np
import streamlit as st
from loguru import logger as log
from PIL import Image
from pydub import AudioSegment

from streamlit.runtime.scriptrunner import RerunData, RerunException
from streamlit.source_util import get_pages
from streamlit_player import st_player
Expand All @@ -33,7 +32,11 @@ def url_is_valid(url):
st.error("Extension not supported.")
return False
try:
return check_file_availability(url)
if check_file_availability(url):
return True
else:
st.error("Not able to reach the URL.")
return False
except Exception:
st.error("URL is not valid.")
return False
Expand Down

0 comments on commit 878b9a1

Please sign in to comment.