Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2022-02-11 20:26:33 +0100
committerAnton Hvornum <anton@hvornum.se>2022-02-11 20:26:33 +0100
commit49a93480a8a10359e174308881e196081256c5dc (patch)
treee5518f342b1655596fdc3ec902c73ee390f19ca3 /archinstall/lib
parent5990491292fb1a9b7dbd80af6109d9e71630a75c (diff)
Added better error output (based on #963)
Diffstat (limited to 'archinstall/lib')
-rw-r--r--archinstall/lib/exceptions.py5
-rw-r--r--archinstall/lib/translation.py7
2 files changed, 10 insertions, 2 deletions
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):