Skip to content

Commit 0d8a585

Browse files
committed
feat: improve HuggingFace proxy error message with Vietnamese translation and proxy list
1 parent e8fe10d commit 0d8a585

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

vnstock/core/utils/client.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,15 @@ def send_request(
191191
if show_log:
192192
logger.warning(f"HF proxy {hf_url} failed: {e}")
193193
continue
194-
raise ConnectionError(f"All HF proxies failed. Last error: {last_exception}")
194+
hf_proxy_links = '\n'.join([f"- {url}" for url in HF_PROXY_URLS])
195+
raise ConnectionError(
196+
"Tất cả các HuggingFace proxy đều thất bại.\n"
197+
"Proxy HuggingFace có thể đang ở trạng thái sleep do không có truy cập thường xuyên.\n"
198+
"Vui lòng click vào một trong các link dưới đây để mở app proxy trên HuggingFace, đợi 5-10 giây rồi thử lại.\n"
199+
f"\nDanh sách proxy đã thử:\n{hf_proxy_links}\n"
200+
f"\nLỗi cuối cùng: {last_exception}"
201+
)
202+
195203
else:
196204
# Chọn HF proxy theo mode
197205
if len(HF_PROXY_URLS) > 1:

0 commit comments

Comments
 (0)