From 49a93480a8a10359e174308881e196081256c5dc Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 11 Feb 2022 20:26:33 +0100 Subject: Added better error output (based on #963) --- archinstall/lib/exceptions.py | 5 +++++ archinstall/lib/translation.py | 7 +++++-- debug.txt | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 debug.txt diff --git a/archinstall/lib/exceptions.py b/archinstall/lib/exceptions.py index b89d1fcb..f6f58151 100644 --- a/archinstall/lib/exceptions.py +++ b/archinstall/lib/exceptions.py @@ -42,5 +42,10 @@ class UserError(BaseException): class ServiceException(BaseException): pass + class PackageError(BaseException): + pass + + +class TranslationError(BaseException): pass \ No newline at end of file diff --git a/archinstall/lib/translation.py b/archinstall/lib/translation.py index 16556fbe..b8a27fed 100644 --- a/archinstall/lib/translation.py +++ b/archinstall/lib/translation.py @@ -6,7 +6,7 @@ import gettext from pathlib import Path from typing import List, Dict - +from .exceptions import TranslationError class Languages: def __init__(self): @@ -60,7 +60,10 @@ class Translation: self._languages = {} for name in self.get_all_names(): - self._languages[name] = gettext.translation('base', localedir=locales_dir, languages=[name]) + try: + self._languages[name] = gettext.translation('base', localedir=locales_dir, languages=[name]) + except FileNotFoundError as error: + raise TranslationError(f"Could not locate language file for '{name}': {error}") def activate(self, name): if language := self._languages.get(name, None): diff --git a/debug.txt b/debug.txt new file mode 100644 index 00000000..a1dca105 --- /dev/null +++ b/debug.txt @@ -0,0 +1 @@ +child says heeyooo \ No newline at end of file -- cgit v1.2.3-70-g09d2