From bf26696e71b2f2c20910eb2f40d0ed6f4b2b8a0a Mon Sep 17 00:00:00 2001 From: Mustafa Hasan Khan <65130881+mustafahasankhan@users.noreply.github.com> Date: Sat, 20 May 2023 12:21:47 +0530 Subject: [PATCH] Catch UnicodeEncodeError exception (#64) --- files.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/files.py b/files.py index 0238bdffa..854106674 100644 --- a/files.py +++ b/files.py @@ -178,10 +178,14 @@ def url_uploader(supabase, vector_store): html = get_html(url) if html: st.write(f"Getting content ... {url} ") + try: + file, temp_file_path = create_html_file(url, html) + except UnicodeEncodeError as e: + st.write(f"❌ Error encoding character: {e}") file, temp_file_path = create_html_file(url, html) ret = filter_file(file, supabase, vector_store) delete_tempfile(temp_file_path, url, ret) else: st.write(f"❌ Failed to access to {url} .") else: - st.write("You have reached your daily limit. Please come back later or self host the solution.") + st.write("You have reached your daily limit. Please come back later or self host the solution.") \ No newline at end of file