From d4e34a4c31e912b512899342ee654fc1c6c61ae2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 11 Jan 2023 09:00:58 +0530 Subject: [PATCH] themes kitten: Nicer error message when no internet connection is present Fixes #5877 --- kittens/themes/main.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kittens/themes/main.py b/kittens/themes/main.py index 44ebf1772..0fa05b087 100644 --- a/kittens/themes/main.py +++ b/kittens/themes/main.py @@ -233,8 +233,11 @@ class ThemesHandler(Handler): self.redraw_after_category_change() def fetch() -> None: + from urllib.error import URLError try: themes: Union[Themes, str] = load_themes(self.cli_opts.cache_age) + except URLError as e: + themes = f'Could not download themes, check your internet connection. Error: {e}' except Exception: themes = format_traceback('Failed to download themes') self.asyncio_loop.call_soon_threadsafe(fetching_done, themes)